... even if the file hasn't changed. This addresses an oddity in the following
case:
* Shell is started,
* function `foo` is sourced from foo.fish
* foo.fish is *externally* edited and saved
* <Loaded definition of `foo` is now stale, but fish is unaware>
* `funced foo` loads `type -p foo` showing changed definition, user exits
$EDITOR saving no changes (or with $status 0, more generally).
* Stale definition of `foo` remains
This used a prompt command, but since the prompt was interpolated and
included a `?` it would be run as a glob without qmark-noglob.
Since it's simpler to pass a prompt string, just do that.
Commit c3374ffd0 ("Use read --tokenize instead of eval for $BROWSER &
$EDITOR") converted uses of "eval" for environment variables to use the
safer "read -at", which performs word splitting but no other expansion.
funced contained a leftover instance of "eval". Remove it in favor
of using the editor command that was already word-split.
This means that we don't accidentally evaluate the file name.
(Also "set -gx EDITOR=~/my-editor" won't work anymore because the ~
is not expanded anymore but no one has complained about that behavior
in edit_command_buffer.)
Fixes#8289
As functions know where they are loaded from now, there is no point in
them being marked as loaded from a temporary file that has been removed.
Source the function via a redirect instead.
For some weird reason we only used $editor if it wasn't empty, but
then failed to fail if it was.
This will now print an error and use fish, just like if the $EDITOR
value is invalid in any other way.
Fixes#5257.
* Check whether tmp file was modified in `funced`
* More idiomatic error messages
* Store the checksum in a local variable
* MD5 function supporting both GNU and BSD
* Use `else if` in MD5 function
* Use `string` builtin instead of `cut`
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
Fix for CVE-2014-2906.
Closes a race condition in funced which would allow execution of
arbitrary code; closes a race condition in psub which would allow
alternation of the data stream.
Note that `psub -f` does not work (#1040); a fix should be committed
separately for ease of maintenance.
Closes#1437
* case no properly handles -h and --help flags, i.e. treats it as
pattern
* fixed case escaping:
The following expressions now work correctly:
switch '*'
echo '*'
echo Match any string
end
switch '*'
echo '\*'
echo Match asterix
end
switch '\\'
echo '\\\\'
echo Match slash
end
The same for '?' sign
* Editor mode is no the default
* Use -i or --interactive or -e fish to edit function in interactive
mode
* tmpname is now created with random number added and check that file
do not already exist
* check $TMPDIR existence and put /tmp if it does not exist
* There is an undocumented feature to use functions, started with dash.
Introduce necessary changes to funced, functions, def_function()
in order to make it work properly.
* Delete editor guessing. Use $EDITOR variable or -e key