-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 While searching for more details about the requirement for `pwd -P' to set PWD in POSIX mode, I found several other compliance bugs:
1) time is no longer allowed to be a reserved word. For example: $ set -o posix $ alias !='echo hi;' $ alias time='echi hi;' $ ! true # ! is reserved word, not alias $ echo $? 1 $ time true # BUG: time should be an alias, and echo hi real 0m0.000s user 0m0.000s sys 0m0.000s $ set +o posix $ ! true # outside of posix mode, bash documents that hi # aliases take precedence over reserved words $ echo $? 0 $ time true # BUG: again, time should be an alias real 0m0.000s user 0m0.000s sys 0m0.000s $ (Likewise, source is not documented as a reserved word, but since time is a POSIX-required utiltiy while source is not, I am okay with source remaining a reserved word.) 2) The wording of bash-3.0/POSIX is misleading on item 4. Rather than stating "Reserved words may not be aliased", you should state something like "An aliased reserved word does not undergo alias expansion if it is in the context of a reserved word". As demonstrated in POSIX XRAT, an aliased reserved word that is not in the context of a reserved word undergoes alias expansion: $ alias while=hi $ alias foo='echo ' $ foo while hi 3) Items 18 and 19 of bash-3.0/POSIX are wrong. Reread the description of cd (http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html), the interpretation on it (http://www.opengroup.org/austin/interps/uploads/40/6230/AI-037.txt), and pending corrections to the interpretation (https://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=8042). Item 18 is wrong because there is nothing that states that the use of CDPATH turns on -P handling. And item 19 is wrong because when CDPATH without . fails to find a directory in step 5, step 6 reverts to using $PWD (the current directory). The following example is required to behave the same in POSIX mode as it currently does for normal bash mode: $ set -o posix $ cd /tmp $ mkdir -p a a/aa $ ln -s a b $ CDPATH=b cd aa /tmp/b/aa $ echo $PWD # BUG: Should be /tmp/b/aa, as printed /tmp/a/aa $ cd - /tmp $ CDPATH=/tmp/a/aa cd b # BUG: Should change to /tmp/b, and set PWD bash: cd: b: No such file or directory 4) POSIX requires that times be a special built-in. For example: $ foo=bar times 0m0.140s 0m0.156s 0m2.078s 0m0.683s $ echo foo: $foo # BUG: should print foo: bar foo: $ (On a related note, I think POSIX is ambiguous on the behavior of the following - does the setting of foo take place before or after it is unset? $ foo=bar unset foo $ echo $foo # Some shells echo bar, others echo nothing ) 5) POSIX requires that newgrp be provided as a regular shell built-in, as well as a standalone utility. POSIX states that "A common implementation of newgrp is that the current shell uses exec to overlay itself with newgrp, which in turn overlays itself with a new shell after changing group. On some implementations, however, this may not occur and newgrp may be invoked as a subprocess." It is the action of overlaying the current shell with newgrp which was the rationale for providing newgrp as a regular built-in, even if you choose to implement the built-in by simply deferring to the standalone utility rather than changing groups within bash before starting the new shell environment. On cygwin, where no one has yet ported a newgrp utility, bash currently fails to be POSIX-compliant because of the missing newgrp builtin: $ newgrp bash: newgrp: command not found - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCGejm84KuGfSFAYARAo+PAKCny1cKGdJl8GMe2Q/7OzDpuEBT4wCgwZyN 2hfpZJ3mrIAIwiGD0B6L3J4= =2B62 -----END PGP SIGNATURE----- _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash