Ticket #36662

test -o breaks on no*

Date d'ouverture: 2016-09-26 05:18 Dernière mise à jour: 2016-09-27 22:20

Rapporteur:
Propriétaire:
Type:
État:
Atteints
Composant:
Jalon:
(Aucun)
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Fixed
Fichier:
2
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Détails

The -o option to the test/[ builtin breaks when an option name starting with no is given.

The expected behaviour is that the result should be inverted if the option name starts with no. Instead, the prefix appears to be ignored.

For example:

set +C && [ -o clobber ] && [ -o noclobber ] && echo bug
outputs 'bug'.

The negative test case

set -C && [ ! -o clobber ] && [ ! -o noclobber ] && echo 'bug?'
is complicated because -o is a binary "or" operator, so [ ! -o noclobber ] can (and according to POSIX arguably should) be read as "test if either the literal string '!' is non-empty or the literal string 'noclobber' is non-empty".

Ticket History (3/7 Histories)

2016-09-26 05:18 Updated by: mcdutchie
  • New Ticket "test -o breaks on no*" created
2016-09-26 08:41 Updated by: mcdutchie
  • Details Updated
Commentaire
(This comment has been deleted)
2016-09-27 00:02 Updated by: magicant
Commentaire

Thank you for reporting the bug and providing the patch.

Your patch apparently fixes the bug, but it mistakenly identifies "notify" as a negation of "tify", which again returns the wrong result. So, we need some more tricks to get everything right. I feel like rewriting the find_option_unique function.

Thanks anyway!

2016-09-27 20:43 Updated by: mcdutchie
Commentaire

Well, that was a really silly oversight on my part. Thanks for catching it.

2016-09-27 22:20 Updated by: magicant
  • Résolution Update from Aucun to Fixed
  • Ticket Close date is changed to 2016-09-27 22:20
  • État Update from Ouvert to Atteints
Commentaire

Committed r3672

Attachment File List

Modifier

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Connexion