mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 00:01:15 -03:00
Allow builtin source to read from non-regular files
Commit a91bf6d88 (builtin.c: builtin_source now checks that its argument is
a file., 2005-12-16) fixed an infinite loop for commands like "source /"
where the argument is a directory.
It did so by erroring out early unless the filename argument is a regular file.
This is too restrictive; it disallows reading from special files like /dev/null
and fifos.
Today we get a sensible error without this check, so remove it.
This commit is contained in:
11
tests/checks/source.fish
Normal file
11
tests/checks/source.fish
Normal file
@@ -0,0 +1,11 @@
|
||||
#RUN: %fish %s
|
||||
|
||||
source /dev/null
|
||||
echo $status
|
||||
# CHECK: 0
|
||||
|
||||
source /
|
||||
echo $status
|
||||
# CHECKERR: error: Unable to read input file: Is a directory
|
||||
# CHECKERR: source: Error while reading file '/'
|
||||
# CHECK: 1
|
||||
Reference in New Issue
Block a user