This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with the new base-files-4.0-5?

On Fri, Mar 18, 2011 at 12:46:26AM +0100, Cyrille Lefevre wrote:
> Le 17/03/2011 23:43, Angelo Graziosi a écrit :
> >p='/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows
> >NT/CurrentVersion/Windows/Device'
> >
> >[ -e "${p}" ] && read -r PRINTER < "${p}" && PRINTER=${PRINTER%%,*}
> read -r "$p" returns 1 bcoz "The return code is zero, unless
> end-of-file is encountered"...
> alternative :
> [ -e "${p}" ] && IFS=',' read -r PRINTER dummy < "${p}"

Works in bash, posh, mksh and zsh, but fails (at least for me) in
As it seems I can't find a short-circuiting option that works, I'll
use the `if' statement, since it appears to work for all shells.

All [[, have been changed to a portable [ test.
I've changed `test -a' for a portable `test -e', and the -a operator
in the user's home ownership test to a chained test:

elif [ ! -O "${HOME}" ] && [ "${HOME#/home/}" != "${HOME}" ]; then ...

which works for all shells but still fails for posh since posh does
not implement the -O test either (as per POSIX compliance, right?). 
This is not easy to solve without rethinking that test, so I plan to 
release 4.0-6 with this known bug, with the following workaround: 
the code block that sets $HOME is now enclosed in a function that 
tests for posh and returns before the ownership test.
The functionality is lost for those who use posh as a login shell (hopefully,
not too many...).
It would be included in the announcement message as well.

This has to be reported to the posh maintainer as well, but:

a) As stated in the manpage, posh -li should read /etc/profile, but it
doesn't (and that's why it doesn't complain about [[ presence in

b) It fails to source some of the /etc/profile.d/*.sh scripts due to not
finding its documented alias builtin:

$ . /etc/profile.d/
posh: /etc/profile.d/ alias: not found
$ builtin alias
posh: builtin: alias: not a builtin

To workaround this, posh won't source them, it's been explicitly disabled.

c) $POSH_VERSION returns literally "POSH_VERSION" (FWIW, both in cygwin
and GNU/Linux), instead of its version identifier, as bash and mksh do.
Maybe it's the expected (though uninformative) behaviour or a known

Last, can someone confirm that calling `dash -i' from mksh results in 
`dash: Bad substitution' errors? (IOW, make mksh your login shell, and
run dash -i from your prompt).

Huella de clave primaria: 0FDA C36F F110 54F4 D42B  D0EB 617D 396C 448B 31EB

Attachment: signature.asc
Description: Digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]