Link [ NetBSD | NetBSD OpenGrok source search | PR fulltext-search | Summary of daily snapshot builds | history of daily build result | pkgsrc commit viewer ]


   
        usage: [branch:branch] [user:user] [path@revision] keyword [... [-excludekeyword [...]]] (e.g. branch:MAIN sys/arch/arm, if_wm.c@1.234 )




switch to index mode

recent branches: MAIN (2h)  netbsd-10 (6d)  netbsd-9 (6d)  netbsd-8 (11d) 

2024-05-23 05:13:28 UTC Now

2018-08-25 14:48:22 UTC netbsd-8 commitmail json YAML

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

(martin)