Mail Archives: cygwin/2011/03/18/09:47:11
X-Recipient: | archive-cygwin AT delorie DOT com
|
X-SWARE-Spam-Status: | No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL
|
X-Spam-Check-By: | sourceware.org
|
Date: | Fri, 18 Mar 2011 14:46:46 +0100
|
From: | David Sastre <d DOT sastre DOT medina AT gmail DOT com>
|
To: | cygwin AT cygwin DOT com
|
Subject: | Re: Problems with the new base-files-4.0-5?
|
Message-ID: | <20110318134646.GA10633@jethro.local.lan>
|
References: | <4D828E8E DOT 6020607 AT alice DOT it> <4D829D52 DOT 3040706 AT laposte DOT net>
|
MIME-Version: | 1.0
|
In-Reply-To: | <4D829D52.3040706@laposte.net>
|
User-Agent: | Mutt/1.5.20 (2009-06-14)
|
X-IsSubscribed: | yes
|
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm
|
List-Id: | <cygwin.cygwin.com>
|
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
|
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com>
|
List-Archive: | <http://sourceware.org/ml/cygwin/>
|
List-Post: | <mailto:cygwin AT cygwin DOT com>
|
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
|
Sender: | cygwin-owner AT cygwin DOT com
|
Mail-Followup-To: | cygwin AT cygwin DOT com
|
Delivered-To: | mailing list cygwin AT cygwin DOT com
|
--T4sUOijqQbZv57TR
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Fri, Mar 18, 2011 at 12:46:26AM +0100, Cyrille Lefevre wrote:
>=20
> Le 17/03/2011 23:43, Angelo Graziosi a =E9crit :
>=20
> >p=3D'/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows
> >NT/CurrentVersion/Windows/Device'
> >
> >[ -e "${p}" ] && read -r PRINTER < "${p}" && PRINTER=3D${PRINTER%%,*}
>=20
> read -r "$p" returns 1 bcoz "The return code is zero, unless
> end-of-file is encountered"...
>=20
> alternative :
>=20
> [ -e "${p}" ] && IFS=3D',' read -r PRINTER dummy < "${p}"
Works in bash, posh, mksh and zsh, but fails (at least for me) in
dash.
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/}" !=3D "${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?).=20
This is not easy to solve without rethinking that test, so I plan to=20
release 4.0-6 with this known bug, with the following workaround:=20
the code block that sets $HOME is now enclosed in a function that=20
tests for posh and returns before the ownership test.
The functionality is lost for those who use posh as a login shell (hopefull=
y,
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
/etc/profile)
b) It fails to source some of the /etc/profile.d/*.sh scripts due to not
finding its documented alias builtin:
$ . /etc/profile.d/mc.sh
posh: /etc/profile.d/mc.sh:1: 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
bug.
Last, can someone confirm that calling `dash -i' from mksh results in=20
`dash: Bad substitution' errors? (IOW, make mksh your login shell, and
run dash -i from your prompt).
--=20
Huella de clave primaria: 0FDA C36F F110 54F4 D42B D0EB 617D 396C 448B 31EB
--T4sUOijqQbZv57TR
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk2DYkUACgkQYX05bESLMes2rQCgjktRaCwf1Kn4y2WwWsfEAtm9
7sIAn31KWTdKfT5QmzdJ4PKY5b0ORmop
=Q7sB
-----END PGP SIGNATURE-----
--T4sUOijqQbZv57TR--
- Raw text -