Commit Graph

1101 Commits

Author SHA1 Message Date
ridiculousfish
da8db7f6f0 Revert "Generate FISH_BUILD_VERSION info for cmake builds"
This reverts commit 25839b8c36.

This was an attempt to simplify the version generation, but it
computed the version at build sytem generation time rather than
at build time, requiring another run of CMake to update it.
2018-01-08 22:28:10 -08:00
Fabian Homborg
aa58cae601 Don't count successive "," as literal in brace expansion
This was highly surprising.

Fixes #3002.
2018-01-07 15:00:44 +01:00
Fabian Homborg
55ebf4430f Make literal "{}" expand to itself
This caused major annoyances with e.g. `find -exec`, and it's utterly
useless - "{}" expands to nothing, so why have it at all?

Fixes #1109.
2018-01-07 15:00:44 +01:00
Fabian Homborg
75ac482cec Don't crash when setting fish_history before reader is initialized
Not crashing is just soo much nicer.

Fixes #4619.
2018-01-01 13:02:39 +01:00
Mahmoud Al-Qudsi
25839b8c36 Generate FISH_BUILD_VERSION info for cmake builds
Correctly generate FISH_BUILD_VERSION for use in fish_version.h/cpp and
fish.pc to allow `fish --version` and `echo $version` to work again.

Not needing the same convoluted measures used by Makefile builds to
prevent the regeneration of the fish version file when it hasn't
changed.

Purposely created a new `cmake_git_version_gen.sh` file so that the old
`git_version_gen.sh` remains compatible with the existing Makefile build
script. Same reason why `fish.pc.in` was not modified to use a lowercase
variable name to match the CMAKE variable of the same name.

Closes #4626
2017-12-30 17:38:09 -06:00
ridiculousfish
3b3047c3f6 Remove unused functions from env_var_t 2017-12-24 00:03:28 -08:00
ridiculousfish
8f8e19bf7b Fix a misleading stale comment 2017-12-22 19:35:59 -08:00
ridiculousfish
d5d3712220 Correct some more memory management in env.cpp 2017-12-22 17:38:25 -08:00
ridiculousfish
efeb8e43a2 Remove a bunch of unnecessary copying in env.cpp 2017-12-22 17:31:25 -08:00
ridiculousfish
2c5b49c3fe Clean up env_var_t interface 2017-12-22 16:54:15 -08:00
ridiculousfish
05b5e8e4f8 Stop copying strings in var_stack_t::var_changed
var_stack_t::var_changed was doing tons of unnecessary string copies.
Fix that and make its name clearer.
2017-12-22 16:28:15 -08:00
ridiculousfish
aa22c744d2 Mark parsed_source_ref_t as storing a const pointer 2017-12-22 15:44:14 -08:00
ridiculousfish
457213a768 Turn debug() into a macro
A large portion of time was spent constructing strings and passing
them to debug(). Turn debug into a macro so that the strings are only
constructed if they're going to be printed.
2017-12-22 15:19:08 -08:00
ridiculousfish
a99eecfad8 Wrap up source code and a parse tree into a new type parsed_source_ref_t
This will make it unnecessary to carry around the parse tree and source
separately, and enable some simplifications.
2017-12-22 14:40:15 -08:00
ridiculousfish
d17b298a48 Factor out the code that executes a builtin from exec_job()
Very early work on untangling the exec_job spaghetti.
2017-12-22 13:41:29 -08:00
ridiculousfish
a2114233ac Fix some warnings 2017-12-21 15:48:48 -08:00
ridiculousfish
0c55b79cfc [string] Instance the argument parsing
This adds a new class arg_iterator_t which encapsulates decisions about
whether to read arguments from stdin or argv. It also migrates the
unread bytes buffer from a static variable to an instance variable.
2017-12-21 12:42:57 -08:00
Fabian Homborg
f9d883dd74 Add and use str2wcstring(string, size_t)
This is just for convenience.
2017-12-20 14:31:29 +01:00
Fabian Homborg
2de38ef7bf [string] Chunk reads
Profiling with callgrind revealed that about 60% of the time in a `something | string match` call
was actually spent in `string_get_arg_stdin()`,
because it was calling `read` one byte at a time.

This makes it read in chunks similar to builtin read.

This increases performance for `getent hosts | string match -v '0.0.0.0*'` from about 300ms to about 30ms (i.e. 90%).
At that point it's _actually_ quicker than `grep`.

To improve performance even more, we'd have to cut down on str2wcstring.

Fixes #4604.
2017-12-20 14:30:41 +01:00
ridiculousfish
11e6cfeb82 [math] Remove exception handling in builtin_math
This handles errors explicitly instead of catching them.
2017-12-18 23:01:16 -08:00
ridiculousfish
91c28449aa [muparser] Parser mathematical functions to return errors instead of throw
Remove exceptions from Parser functions such as sqrt, min, and others.
2017-12-18 23:01:16 -08:00
ridiculousfish
9649b132bd [muparser] Continue adopting ValueOrError 2017-12-18 23:01:15 -08:00
ridiculousfish
5655f255ef [muparser] Add a muParser ValueOrError type
First steps towards removing exceptions from muParser.
2017-12-18 23:01:15 -08:00
ridiculousfish
81dd4a4536 [math] Remove more bare variable support
Prior to this fix, a "bare variable" in math like 'x + 1' would be
looked up in the environment, i.e. equivalent to '$x + 1'. This appears
to have been done for performance. However this breaks the orthogonality
of fish; performance is not a sufficient justification to give math this
level of built-in power, especially because the performance of math is
not a bottleneck. The implementation is also ugly.

Remove this feature so that variables must be prefixed with the dollar
sign and undergo normal variable expansion. Reading 'git grep' output
does not show any uses of this in fish functions or completions.

Also added to changelog.

Fixes #4393
2017-12-17 12:40:09 -08:00
Alan Somers
8fb6d5db3b Fix the build on FreeBSD ARM and ARM64 (#4593)
Downstream bug:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224254

Fixes #4589
2017-12-12 22:45:17 -08:00
hazem samir
c45d4abaef Implement Linear glob match #4094 2017-12-10 20:12:40 -08:00
ridiculousfish
bc28bd7d6d Use some modern initialization syntax in builtin_wait
Avoids potentially dangling pointers.
2017-11-16 10:54:34 -08:00
ridiculousfish
7c8ed80e64 Fix up builtin_wait build system
Add missing CMake and Xcode files, and mark some variables as const
reference.
2017-11-16 10:48:21 -08:00
slama
c7a682ed05 add wait command 2017-11-16 10:48:21 -08:00
David Adam
ea5f3925ea drop USE_GETTEXT macro and use only HAVE_GETTEXT
There is no clear rationale for the two separate macros.
2017-11-16 21:29:42 +08:00
Andrew Stewart
9c060126b5 fixed small typo in src/builtin_jobs.cpp (#4530) 2017-11-10 11:41:02 -08:00
David Adam
848db48af5 Improve warning message when exiting with active jobs
Work on #4303.
2017-10-31 19:18:44 +08:00
David Adam
eb081481c6 warning message when exiting with active jobs uses PID of first process, not PGID
Work on #4303.
2017-10-31 19:17:21 +08:00
David Adam
b34b0cf1e3 Restore previous output of status current-{filename,function}
Closes #4499.

Partial reversion of 30368d5526.
2017-10-31 18:10:46 +08:00
Valery Ushakov
8f0f05ca44 Rewrite tparm_solaris_kludge to call tparm with default parameters
Closes #4502.
2017-10-31 16:48:35 +08:00
David Adam
216c4b811a only call ioctl to export new termsize if process is in the foreground
Closes #4477.
2017-10-21 07:21:17 +08:00
slama
7004c30f95 allow edit across newlines wherever the cursor is if the line ends with a backslash.
Fixes #4467
2017-10-18 11:58:01 -07:00
Aaron Gyes
a9283803d4 Revert "Non-exported vars: rename SHLVL to shlvl"
Duh, of course it is exported.

This reverts commit 5fc17dcc82.
2017-10-15 04:37:34 -07:00
Aaron Gyes
5fc17dcc82 Non-exported vars: rename SHLVL to shlvl
Fixes #4414
2017-10-15 04:33:27 -07:00
Aaron Gyes
fb8ae04f80 Rename $FISH_VERSION back to the original $version.
Order is restored in the universe. Fixes #4414
2017-10-14 08:33:02 -07:00
Aaron Gyes
7be8a1707c Rename FISH_READ_BYTE_LIMIT to fish_read_limit
Fixes #4414
2017-10-14 08:33:02 -07:00
Aaron Gyes
18b06f3768 Rename CMD_DURATION to cmd_duration
Fixes #4414
2017-10-14 08:33:02 -07:00
Mahmoud Al-Qudsi
0a1294758d Replace opts.stdout with opts.to_stdout
For some reason on Solaris the previous code was refusing to compile
with an error (regarding the declaration of stdout in the opts struct)

    error: declaration of ‘__iob’ as array of references

The obvious guess that it had something to do with the name of the
variable in question proved true; renaming it from `stdout` to
`opts.stdout` allows the build to go through.
2017-10-12 11:44:14 -05:00
ridiculousfish
1f130bcc9c Change wrealpath to return a maybe_t
Simplify the wrealpath interface and avoid manual invocations of free() by
changing wrealpath to return a maybe_t<wcstring>.
2017-10-11 00:08:26 -07:00
ridiculousfish
05c0cb713d Stop passing NULL for realpath()'s second param
macOS 10.5 and earlier do not support the convention of returning
a dynamically allocated string, plus this seems like an unnecessary
malloc. Always allocate a buffer for realpath() to write into.
2017-10-10 23:31:27 -07:00
Mahmoud Al-Qudsi
639faf1c7f Fix uninitialized memory access dependent on argc
It seems that `parse_cmd_opts` does not correctly handle no arguments,
and so argc was being decremented to -1 causing uninitialized memory
access when argv[0] was dereferenced at a later point.
2017-10-11 07:22:42 +02:00
Mahmoud Al-Qudsi
8ffc3ab242 Drop no-longer-needed iostream header from src/builtin_read.cpp 2017-10-10 08:23:24 +02:00
Mahmoud Al-Qudsi
d0bc04cb40 Change read to stdout behavior to kick in on no arguments only
No longer using `-` to indicate reading to stdout. Use lack of arguments
as stdout indicator. This prevents mixing of variables with stdout
reading and makes it clear that stdout may not be mixed with delimiters
or array mode.
2017-10-10 08:23:23 +02:00
Mahmoud Al-Qudsi
06afcb43b4 Support reading to stdout via builtin read -
Added an option to read to stdout via `read -`. While it may seem
useless at first blush, it lets you do things like include

    mysql -p(read --silent) ...

Without needing to save to a local variable and then echo it back.
Kicks in when `-` is provided as the variable name to read to. This is
in keeping with the de facto syntax for reading/writing from/to
stdin/stdout instead of a file in, e.g., tar, cat, and other standard
unix utilities.
2017-10-10 08:23:23 +02:00
Mahmoud Al-Qudsi
e99f137356 Merge branch 'master' into history-glob-search 2017-10-10 08:16:21 +02:00