NetBSD Problem Report #48499
From www@NetBSD.org Sat Jan 4 16:47:54 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id AD179A61B7
for <gnats-bugs@gnats.NetBSD.org>; Sat, 4 Jan 2014 16:47:54 +0000 (UTC)
Message-Id: <20140104164753.74FD2A646D@mollari.NetBSD.org>
Date: Sat, 4 Jan 2014 16:47:53 +0000 (UTC)
From: sdaoden@gmail.com
Reply-To: sdaoden@gmail.com
To: gnats-bugs@NetBSD.org
Subject: sh(1) doesn't allow the POSIX command(1) -pv
X-Send-Pr-Version: www-1.0
>Number: 48499
>Category: bin
>Synopsis: sh(1) doesn't allow the POSIX command(1) -pv
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kre
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jan 04 16:50:00 +0000 2014
>Closed-Date: Wed Jul 25 22:41:42 +0000 2018
>Last-Modified: Sat Aug 25 14:50:00 +0000 2018
>Originator: Steffen
>Release: head
>Organization:
>Environment:
NetBSD nhead 6.99.28 NetBSD 6.99.28 (GENERIC) #0: Fri Jan 3 05:24:46 UTC 2014 builds@b8.netbsd.org:/home/builds/ab/HEAD/i386/201401022300Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC i386
>Description:
* [steffen@nhead]$ command -pv sed
command: cannot specify -p with -v or -V
POSIX [1]:
Issue 7
Austin Group Interpretation 1003.1-2001 #196 is applied, changing the SYNOPSIS to allow -p to be used with -v (or -V).
[1] <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html>
>How-To-Repeat:
* [steffen@nhead]$ command -vp sh
/bin/sh
>Fix:
--- exec.c.orig 2014-01-03 23:17:17.000000000 +0100
+++ exec.c 2014-01-03 23:17:04.000000000 +0100
@@ -974,9 +974,6 @@ typecmd(int argc, char **argv)
}
}
- if (p_flag && (v_flag || V_flag))
- error("cannot specify -p with -v or -V");
-
while ((arg = *argptr++)) {
if (!v_flag)
out1str(arg);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->kre
Responsible-Changed-By: kre@NetBSD.org
Responsible-Changed-When: Wed, 25 Jul 2018 11:46:31 +0000
Responsible-Changed-Why:
I am looking into this PR
From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48499 CVS commit: src/bin/sh
Date: Wed, 25 Jul 2018 14:42:50 +0000
Module Name: src
Committed By: kre
Date: Wed Jul 25 14:42:50 UTC 2018
Modified Files:
src/bin/sh: eval.c eval.h exec.c
Log Message:
Fix several bugs in the command / type builtin ( including PR bin/48499 )
1. Make command -pv (and -pV) work (which is not as easy as the PR
suggests it might be (the "check and cause error" was there because
it did not work, not in order to prevent it from working).
2. Stop -v and -V being both used (that makes no sense).
3. Stop the "type" builtin inheriting the args (-pvV) that "command" has
(which it did, as when -v -or -V is used with command, it and type are
implemented using the same code).
4. make "command -v word" DTRT for sh keywords (was treating them as an error).
5. Require at least one arg for "command -[vV]" or "type" else usage & error.
Strictly this should also apply to "command" and "command -p" (no -v)
but that's handled elsewhere, so perhaps some other time. Perhaps
"command -v" (and -V) should be limited to 1 command name (where "type"
can have many) as in the POSIX definitions, but I don't think that matters.
6. With "command -V alias", (or "type alias" which is the same thing),
(but not "command -v alias") alter the output format, so we get
ll is an alias for: ls -al
instead of the old
ll is an alias for
ls -al
(and note there was a space, for some reason, after "for")
That is, unless the alias value contains any \n characters, in which
case (something approximating) the old multi-line format is retained.
Also note: that if code wants to parse/use the value of an alias, it
should be using the output of "alias name", not command or type.
Note that none of the above affects "command [-p] cmd" (no -v or -V options)
only "command -[vV]" and "type".
Note also that the changes to eval.[ch] are merely to make syspath()
visible in exec.c rather than static in eval.c
To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/bin/sh/eval.c
cvs rdiff -u -r1.19 -r1.20 src/bin/sh/eval.h
cvs rdiff -u -r1.52 -r1.53 src/bin/sh/exec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: kre@NetBSD.org
State-Changed-When: Wed, 25 Jul 2018 14:45:28 +0000
State-Changed-Why:
Please test (if possible) the version of /bin/sh from NetBSD current
(cvs tag HEAD) more recent than Wed, 25 Jul 2018 14:42:50 +0000 and
see if this meets your needs.
From: Steffen Nurpmeso <steffen@sdaoden.eu>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
Date: Wed, 25 Jul 2018 17:48:14 +0200
Hello.
kre@NetBSD.org wrote in <20180725144528.C09197A212@mollari.NetBSD.org>:
|Synopsis: sh(1) doesn't allow the POSIX command(1) -pv
|
|State-Changed-From-To: open->feedback
|State-Changed-By: kre@NetBSD.org
|State-Changed-When: Wed, 25 Jul 2018 14:45:28 +0000
|State-Changed-Why:
|Please test (if possible) the version of /bin/sh from NetBSD current
|(cvs tag HEAD) more recent than Wed, 25 Jul 2018 14:42:50 +0000 and
|see if this meets your needs.
Great. I have found the report: from 2014-01-04. ^.^
This is really not easy for me, so much download. Only to find
out it is working that is, in which i am very confident...
I have seen NetBSD now follows No. 1 regarding context revelation:
#?1[steffen@essex ]$ alias a=b
#?0[steffen@essex ]$ alias b='echo c'
#?0[steffen@essex ]$ a
c
#?0[steffen@essex ]$ command -v a
alias a='b'
#?0[steffen@essex ]$ command -V a
a is aliased to `b'
May i suggest going one step further for this interactive thing,
e.g., my MUA now shows recursive aliases as necessary:
#?0!0/NONE[#/var/spool/mail/steffen]? commandalias a b
#?0!0/NONE[#/var/spool/mail/steffen]? commandalias b echo c
#?0!0/NONE[#/var/spool/mail/steffen]? ?a
a -> b -> 'echo c'
Thank you, and
Ciao from midsummer Germany,
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
State-Changed-From-To: feedback->open
State-Changed-By: kre@NetBSD.org
State-Changed-When: Wed, 25 Jul 2018 17:03:54 +0000
State-Changed-Why:
foodback received
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
Date: Thu, 26 Jul 2018 00:11:43 +0700
Date: Wed, 25 Jul 2018 15:50:01 +0000 (UTC)
From: Steffen Nurpmeso <steffen@sdaoden.eu>
Message-ID: <20180725155001.7A2D47A22E@mollari.NetBSD.org>
| Great. I have found the report: from 2014-01-04. ^.^
We are gardually cleaning up the reported problems....
gradually!
| This is really not easy for me, so much download.
I understand. If you have a working NetBSD (7 or more recent)
and you tell me which version, I can probably make you a sh binary
from current sh sources, to work on that system, if you'd like to try it.
Otherwise I'll wait a bit in case there any other reported issues, and
then close this.
| I have seen NetBSD now follows No. 1 regarding context revelation:
|
| #?1[steffen@essex ]$ alias a=b
| #?0[steffen@essex ]$ alias b='echo c'
| #?0[steffen@essex ]$ a
| c
This much could be from the NetBSD sh, but
| #?0[steffen@essex ]$ command -v a
| alias a='b'
| #?0[steffen@essex ]$ command -V a
| a is aliased to `b'
that isn't, that looks like bash.
What NetBSD sh (from HEAD) does is ...
[jinx]$ command -v a
b
[jinx]$ command -V a
a is an alias for: b
| May i suggest going one step further for this interactive thing,
[...]
| a -> b -> 'echo c'
You can send in another PR (a change request) for that if you
like, and we'll see what people think - but I would not be inclinded
to go that far unless there is a real demand for it (just means a
bunch of extra code for an obscure feature (aliases) that should
probably just be removed anyway).
| Ciao from midsummer Germany,
I was once told that "ausweidersehen" was inappropriate for a
phone call, and I'd guess "ausweiderhoeren" is just as
inappropriate for an e-mail, so "ausweiderbreifen" ???
kre
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
Date: Thu, 26 Jul 2018 01:30:30 +0700
Date: Wed, 25 Jul 2018 17:15:00 +0000 (UTC)
From: Robert Elz <kre@munnari.OZ.AU>
Message-ID: <20180725171500.BC0B67A210@mollari.NetBSD.org>
| so "ausweiderbreifen" ???
Ugh, memory is worse than Ieven I thought (which is saying something)
maybe auswiederschreiben ?
kre
From: Steffen Nurpmeso <steffen@sdaoden.eu>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
Date: Wed, 25 Jul 2018 22:47:20 +0200
Robert Elz wrote in <20180725171500.BC0B67A210@mollari.NetBSD.org>:
|The following reply was made to PR bin/48499; it has been noted by GNATS.
|
|From: Robert Elz <kre@munnari.OZ.AU>
|To: gnats-bugs@NetBSD.org
|Cc:=20
|Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
|Date: Thu, 26 Jul 2018 00:11:43 +0700
|
| Date: Wed, 25 Jul 2018 15:50:01 +0000 (UTC)
| From: Steffen Nurpmeso <steffen@sdaoden.eu>
| Message-ID: <20180725155001.7A2D47A22E@mollari.NetBSD.org>
|=20
|| Great. I have found the report: from 2014-01-04. ^.^
|=20
| We are gardually cleaning up the reported problems....
|=20
| gradually!
Of course. I did not want to imply some kind of pressure, except
maybe of that of my own surprise, since i had totally forgotten
about this report.
|| This is really not easy for me, so much download.
|=20
| I understand. If you have a working NetBSD (7 or more recent)
| and you tell me which version, I can probably make you a sh binary
| from current sh sources, to work on that system, if you'd like to try it.
|=20
| Otherwise I'll wait a bit in case there any other reported issues, and
| then close this.
Of course i will run NetBSD. 8.0_RC1, to be exact. I checked out
sh, test, kill and printf
#[steffen@nbsd]$ export CVSROOT=3D"anoncvs@anoncvs.NetBSD.org:/cvsroot"
#[steffen@nbsd]$ cvs checkout -r -P src bin/sh
Warning: Permanently added the RSA host key for IP address '199.233.217.1=
98' to the list of known hosts.
cvs server: cannot find module `bin/sh' - ignored
cvs [checkout aborted]: cannot expand modules
(i got it right later..), did some "ln -s" (should have looked in
the Makefile and set NETBSDSRCDIR), and compiled it without
problems. I can confirm that it works:
#[steffen@nbsd]$ cd bin/
/home/steffen/usr-nbsd-netbsd-i386/bin
#[steffen@nbsd]$ ln -s /bin/date gcc
#[steffen@nbsd]$ cd
/home/steffen
#[steffen@nbsd]$ command -v gcc
/home/steffen/usr-nbsd-netbsd-i386/bin/gcc
#[steffen@nbsd]$ command -pv gcc
/usr/bin/gcc
|| I have seen NetBSD now follows No. 1 regarding context revelation:
|| =20
|| #?1[steffen@essex ]$ alias a=3Db
|| #?0[steffen@essex ]$ alias b=3D'echo c'
|| #?0[steffen@essex ]$ a
|| c
|=20
| This much could be from the NetBSD sh, but
|=20
|| #?0[steffen@essex ]$ command -v a
|| alias a=3D'b'
|| #?0[steffen@essex ]$ command -V a
|| a is aliased to `b'
|=20
| that isn't, that looks like bash.
|=20
| What NetBSD sh (from HEAD) does is ...
|=20
| [jinx]$ command -v a
| b=20
| [jinx]$ command -V a
| a is an alias for: b=20
Yes, it is different:
#[steffen@nbsd]$ command -V s-groff
s-groff is an alias for: groff -dpaper=3Da4 -P-pa4=20
|| May i suggest going one step further for this interactive thing,
| [...]
|| a -> b -> 'echo c'
|=20
| You can send in another PR (a change request) for that if you
| like, and we'll see what people think - but I would not be inclinded
| to go that far unless there is a real demand for it (just means a
| bunch of extra code for an obscure feature (aliases) that should
| probably just be removed anyway).
Ok... Ok, i realize that the NetBSD shell allows function names
which contain a hyphen-minus.
|| Ciao from midsummer Germany,
|=20
| I was once told that "ausweidersehen" was inappropriate for a
| phone call, and I'd guess "ausweiderhoeren" is just as
| inappropriate for an e-mail, so "ausweiderbreifen" ???
--End of <20180725171500.BC0B67A210@mollari.NetBSD.org>
Robert Elz wrote in <20180725183501.3CE987A210@mollari.NetBSD.org>:
|The following reply was made to PR bin/48499; it has been noted by GNATS.
|
|From: Robert Elz <kre@munnari.OZ.AU>
|To: gnats-bugs@NetBSD.org
|Cc:=20
|Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
|Date: Thu, 26 Jul 2018 01:30:30 +0700
|
| Date: Wed, 25 Jul 2018 17:15:00 +0000 (UTC)
| From: Robert Elz <kre@munnari.OZ.AU>
| Message-ID: <20180725171500.BC0B67A210@mollari.NetBSD.org>
|=20
|| so "ausweiderbreifen" ???
|=20
| Ugh, memory is worse than Ieven I thought (which is saying something)
|=20
| maybe auswiederschreiben ?
Very nice!!! I am inclined to correct an elder and wiser man in
that it should be "auf", and yes, why not "Auf Wiederschreiben"?
(But i never encountered this term. "Auf Wiedersehen" and "Auf
Wiederh=C3=B6ren" for seeing and hearing are very common still. Even
in Germany that is, but mind you, it will not take long and we are
all talking English, unless a miracle happens.)
--End of <20180725183501.3CE987A210@mollari.NetBSD.org>
I wish i could put some heart and soul in calligraphic Thai.
Good bye!
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
State-Changed-From-To: open->closed
State-Changed-By: kre@NetBSD.org
State-Changed-When: Wed, 25 Jul 2018 22:41:42 +0000
State-Changed-Why:
Submitter confirms that problem is fixed
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
Date: Thu, 26 Jul 2018 05:39:48 +0700
Date: Wed, 25 Jul 2018 20:50:01 +0000 (UTC)
From: Steffen Nurpmeso <steffen@sdaoden.eu>
Message-ID: <20180725205001.395FF7A210@mollari.NetBSD.org>
| I can confirm that it works:
Great. Thanks.
| Ok... Ok, i realize that the NetBSD shell allows function names
| which contain a hyphen-minus.
It allosw more than that - anything but \0 and / (and that exception
only because it is impossible to call a function if its name includes /)
(And yes, you can have a \n in a function name ...)
| Very nice!!! I am inclined to correct an elder and wiser man in
| that it should be "auf",
Much elder, I presume, not at all wiser, and yes, of course, no idea
how I screwed that one up ... (it was all so long ago, and I never
was very good).
| and yes, why not "Auf Wiederschreiben"?
Indeed!
| (But i never encountered this term.
I am not particularly surprised. Especially when ciao works!
| in Germany that is, but mind you, it will not take long and we are
| all talking English, unless a miracle happens.)
Americans! (so it probably won't really be English).
| I wish i could put some heart and soul in calligraphic Thai.
Me too.
| Good bye!
\u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35 & G'day mate.
kre
From: Steffen Nurpmeso <steffen@sdaoden.eu>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
Date: Fri, 27 Jul 2018 00:49:31 +0200
Robert Elz wrote in <20180725224501.609C57A22E@mollari.NetBSD.org>:
|From: Robert Elz <kre@munnari.OZ.AU>
|To: gnats-bugs@NetBSD.org
|Subject: Re: bin/48499 (sh(1) doesn't allow the POSIX command(1) -pv)
|Date: Thu, 26 Jul 2018 05:39:48 +0700
|
| Date: Wed, 25 Jul 2018 20:50:01 +0000 (UTC)
| From: Steffen Nurpmeso <steffen@sdaoden.eu>
| Message-ID: <20180725205001.395FF7A210@mollari.NetBSD.org>
|
|| I can confirm that it works:
|
| Great. Thanks.
It is indeed my pleasure.
|| Ok... Ok, i realize that the NetBSD shell allows function names
|| which contain a hyphen-minus.
|
| It allosw more than that - anything but \0 and / (and that exception
| only because it is impossible to call a function if its name includes /)
| (And yes, you can have a \n in a function name ...)
It is always depressing to realize how shallow i am scratching at
the surface of the things i use, may it be vim, the shell, not to
quote undefined C behaviour as an example.
Newline definetely appears esoteric to me.
|| Very nice!!! I am inclined to correct an elder and wiser man in
|| that it should be "auf",
|
| Much elder, I presume, not at all wiser, and yes, of course, no idea
Then i turn to the adjective more experienced without any
transition. Much more experienced.
| how I screwed that one up ... (it was all so long ago, and I never
| was very good).
I was thinking you made it "off" consciously, of course i failed
to find some kind of appealing response to that, nothing more nor
less.
|| and yes, why not "Auf Wiederschreiben"?
|
| Indeed!
|
|| (But i never encountered this term.
|
| I am not particularly surprised. Especially when ciao works!
Bella ciao, Bella ciao, Bella ciao ciao ciao. Works.
|| in Germany that is, but mind you, it will not take long and we are
|| all talking English, unless a miracle happens.)
|
| Americans! (so it probably won't really be English).
|
|| I wish i could put some heart and soul in calligraphic Thai.
|
| Me too.
|
|| Good bye!
|
| \u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35 & G'day mate.
Thank you very much. All in return, and greetings to Thailand!
Best wishes from Germany.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48499 CVS commit: [netbsd-8] src/bin/sh
Date: Sat, 25 Aug 2018 14:48:22 +0000
Module Name: src
Committed By: martin
Date: Sat Aug 25 14:48:22 UTC 2018
Modified Files:
src/bin/sh [netbsd-8]: eval.c eval.h exec.c
Log Message:
Pull up following revision(s) (requested by kre in ticket #989):
bin/sh/eval.c: revision 1.156
bin/sh/eval.h: revision 1.20
bin/sh/exec.c: revision 1.53
Fix several bugs in the command / type builtin ( including PR bin/48499 )
1. Make command -pv (and -pV) work (which is not as easy as the PR
suggests it might be (the "check and cause error" was there because
it did not work, not in order to prevent it from working).
2. Stop -v and -V being both used (that makes no sense).
3. Stop the "type" builtin inheriting the args (-pvV) that "command" has
(which it did, as when -v -or -V is used with command, it and type are
implemented using the same code).
4. make "command -v word" DTRT for sh keywords (was treating them as an error).
5. Require at least one arg for "command -[vV]" or "type" else usage & error.
Strictly this should also apply to "command" and "command -p" (no -v)
but that's handled elsewhere, so perhaps some other time. Perhaps
"command -v" (and -V) should be limited to 1 command name (where "type"
can have many) as in the POSIX definitions, but I don't think that matters.
6. With "command -V alias", (or "type alias" which is the same thing),
(but not "command -v alias") alter the output format, so we get
ll is an alias for: ls -al
instead of the old
ll is an alias for
ls -al
(and note there was a space, for some reason, after "for")
That is, unless the alias value contains any \n characters, in which
case (something approximating) the old multi-line format is retained.
Also note: that if code wants to parse/use the value of an alias, it
should be using the output of "alias name", not command or type.
Note that none of the above affects "command [-p] cmd" (no -v or -V options)
only "command -[vV]" and "type".
Note also that the changes to eval.[ch] are merely to make syspath()
visible in exec.c rather than static in eval.c
To generate a diff of this commit:
cvs rdiff -u -r1.140.2.5 -r1.140.2.6 src/bin/sh/eval.c
cvs rdiff -u -r1.19.8.1 -r1.19.8.2 src/bin/sh/eval.h
cvs rdiff -u -r1.47.2.3 -r1.47.2.4 src/bin/sh/exec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.