Public bug reported:

If you have a non-executable file in the PATH, the "type" builtin will
show it, just like an executable file. However, "type -a" does not. Is
this expected behaviour, or is it a bug?

For example:

$ touch non-exec
$ PATH=.
$ type non-exec
non-exec is ./non-exec
$ type -a non-exec
bash: type: non-exec: not found

The manpage describes this behaviour, but it doesn't explain why it
exists. Personally, I would have expected "type" and "type -a" to behave
the same.

I stumbled on this while writing a Bash function that expands on "type",
providing info like whether a function is marked for export, executable
file type, etc, and this behaviour makes it difficult to parse "type
-at".

This occurs on 17.10 with Bash 4.4.12, though I'm running 14.04 with
Bash 4.3.11.

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1744397

Title:
  "type" builtin - inconsistent behaviour for non-executable files

Status in bash package in Ubuntu:
  New

Bug description:
  If you have a non-executable file in the PATH, the "type" builtin will
  show it, just like an executable file. However, "type -a" does not. Is
  this expected behaviour, or is it a bug?

  For example:

  $ touch non-exec
  $ PATH=.
  $ type non-exec
  non-exec is ./non-exec
  $ type -a non-exec
  bash: type: non-exec: not found

  The manpage describes this behaviour, but it doesn't explain why it
  exists. Personally, I would have expected "type" and "type -a" to
  behave the same.

  I stumbled on this while writing a Bash function that expands on
  "type", providing info like whether a function is marked for export,
  executable file type, etc, and this behaviour makes it difficult to
  parse "type -at".

  This occurs on 17.10 with Bash 4.4.12, though I'm running 14.04 with
  Bash 4.3.11.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1744397/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to