From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: dash@vger.kernel.org
Subject: [PATCH 1/2] exec: type: ignore first --, per POSIX
Date: Tue, 13 Dec 2022 22:13:33 +0100 [thread overview]
Message-ID: <b9085f1a9812a436d37bc6f8d96d17bdba4433c5.1670966008.git.nabijaczleweli@nabijaczleweli.xyz> (raw)
[-- Attachment #1: Type: text/plain, Size: 1182 bytes --]
Issue 7, XCU, type, OPTIONS reads "None.",
and type isn't a special built-in listed in sexion 2.14 ‒
this means that XCU, 1. Introduction, 1.4 Utility Description Defaults,
OPTIONS, Default Behavior applies:
Default Behavior: When this section is listed as "None.", it means
that the implementation need not support any options. Standard
utilities that do not accept options, but that do accept operands,
shall recognize "--" as a first argument to be discarded.
Test with: type -- ls --
Correct output lists ls=/bin/ls, then --=ENOENT
Wrong output lists --=ENOENT, ls=/bin/ls, --=ENOENT
Fixes: https://bugs.debian.org/870317
---
src/exec.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/exec.c b/src/exec.c
index 87354d4..d61881d 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -760,11 +760,11 @@ unsetfunc(const char *name)
int
typecmd(int argc, char **argv)
{
- int i;
int err = 0;
- for (i = 1; i < argc; i++) {
- err |= describe_command(out1, argv[i], NULL, 1);
+ nextopt(nullstr);
+ while (*argptr) {
+ err |= describe_command(out1, *argptr++, NULL, 1);
}
return err;
}
--
2.30.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2022-12-13 21:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 21:13 наб [this message]
2022-12-13 21:13 ` [PATCH 2/2] options: getopts: ignore first --, per POSIX наб
2023-01-02 9:19 ` [PATCH 1/2] exec: type: " Herbert Xu
2023-01-02 12:46 ` наб
2023-01-02 13:34 ` Harald van Dijk
2023-01-03 1:39 ` Herbert Xu
2023-01-03 12:40 ` наб
2023-01-04 2:10 ` Herbert Xu
2023-01-04 11:33 ` [PATCH v2 1/2] options: getopts: " наб
2023-01-08 12:06 ` Herbert Xu
2023-01-04 11:35 ` [PATCH v2 2/2] exec: type: ignore first -- for consistency наб
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9085f1a9812a436d37bc6f8d96d17bdba4433c5.1670966008.git.nabijaczleweli@nabijaczleweli.xyz \
--to=nabijaczleweli@nabijaczleweli.xyz \
--cc=dash@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).