Commit Graph

4769 Commits

Author SHA1 Message Date
Kevin Ballard
387ec5c06a set: Don't create empty var when erasing index
When using `set -e foo[1]` to erase an index, if the variable doesn't
already exist, return 1 instead of creating it as an empty variable.
2014-07-12 15:43:32 -07:00
Kevin Ballard
dcc043df3b Add an optional mode to env_get_string()
The mode restricts the scope in which the variable is searched for.

Use this new restricted scope functionality in the `set` builtin. This
fixes `set -g` to not show local shadowing variable values, and also
allows for scoped erasing of slices.
2014-07-12 15:35:34 -07:00
Kevin Ballard
2457997cd9 set: Print an error when setting a special var in the wrong scope
When attempting to set a readonly or electric variable in the local or
universal scopes, print an appropriate error. Similarly, print an error
when setting an electric variable as exported. In most cases this is
simply a nicer error instead of the 'read-only' one, but for the 'umask'
variable it prevents `set -l umask 0023` from silently changing the
global value.
2014-07-12 14:07:55 -07:00
Kevin Ballard
d9bed68fe9 Mark COLUMNS/LINES as electric vars
They're dynamically calculated, so they qualify. This also removes them
from the list of exported global variables, because they're actually not
exported.
2014-07-12 14:07:55 -07:00
Kevin Ballard
2eb65b3625 set: Don't treat toplevel scope the same as global
When using the `set` command with the -l flag, if we're at the top
level, create a temporary local scope. This makes query/assignment
behavior be consistent with the value-printing behavior.

This works by marking the current block as needing to pop the
environment if a local scope was pushed. I assume this is safe to do. I
also assume the current block is the right one to modify, rather than
trying to walk up the stack to the root.
2014-07-12 14:07:55 -07:00
Kevin Ballard
76fdfe6890 Rewrite env_exists() for better scope handling
env_exists() wasn't properly handling multiple scopes in some cases,
notably with readonly/electric variables. Rewrite it to operate in a
more straightforward fashion.
2014-07-12 14:07:55 -07:00
ridiculousfish
495adee269 Don't sanity_lose if INTERNAL_BLOCK_NODEs have a null argv
Fixes #1545
2014-07-12 11:01:00 -07:00
Kevin Ballard
383aaa236e Don't allow readonly/electric values to come in through the env
When initializing fish, ignore any inherited environment variables that
match any of the readonly or electric variable names.

This prevents really weird behavior when e.g. fish is launched with
COLUMNS already set to something. In that case, testing $COLUMNS within
fish behaves normally, but any subprocesses get the value that fish
itself had inherited.
2014-07-12 00:53:23 -07:00
Kevin Ballard
8c89e6bce5 Fix typo and tweak set docs
Move the docs for the `-n` flag to `set` out of the list of scopes.
2014-07-12 00:21:04 -07:00
ridiculousfish
98297e5234 Teach while loops to not hang forever with no-execute
Fixes #1543
2014-07-11 11:28:10 -07:00
ridiculousfish
3915faf382 bind should not show -k for bindings that are escape sequences, not keys 2014-07-07 10:45:26 -07:00
ridiculousfish
d5fa4b2ccb Remove errant debug line 2014-07-07 02:01:43 -07:00
ridiculousfish
3ff104ba30 Rename lock_t to mutex_lock_t to fix Solaris compilation
Fixes #1510
2014-07-07 00:38:37 -07:00
Daniel J. Hofmann
706286c289 Fixes use-after-free issue.
Calling writer() might fail in which case launch_buff gets freed.
This patch prevents the subsequent use of memory after it was freed.
2014-07-06 20:54:19 -07:00
ridiculousfish
18c1b12741 Switch variable name in tests from foo to something less likely to be
used accidentally
2014-07-06 20:41:21 -07:00
ridiculousfish
5cda1e55e0 Must load universal variables earlier, and issue a barrier after erasing
one.

Fixes #1526
2014-07-06 18:12:18 -07:00
ridiculousfish
195cd130f8 Fix sense of test in parse_execution to issue a barrier if an external
command has run
2014-07-06 18:12:18 -07:00
ridiculousfish
b19f45e15d Add test for issue 1526 2014-07-06 18:12:18 -07:00
Maxim Gonchar
3acd0dfe48 Add dropbox completion 2014-07-06 20:40:53 +08:00
ridiculousfish
74cedbf1c5 Hopeful fix for Cygwin build (#1530) 2014-07-05 10:22:20 -07:00
Siteshwar Vashisht
7d47ec4c46 Properly handle invalid arguments in builtins
Fixes #1522
2014-07-02 17:04:58 +05:30
callesg
14cdd24f78 Added better build description closes #70
The stuff nedded to build on Ubuntu
2014-07-01 16:08:37 +02:00
David Adam
1cfd055f82 env.cpp: allow all users to change $USER and $HOME
Closes 1425 (https://github.com/fish-shell/fish-shell/issues/1425)
2014-06-28 19:16:29 +08:00
Sascha
ed5e585684 Also add forward/backward movement in insert mode 2014-06-27 22:55:27 +08:00
Sascha
32948b8dc6 Provide more useful insert mode mappings 2014-06-27 22:55:20 +08:00
Cameron Norman
ad5ad3d1ad Fix bug for systemd being installed but not PID 1 2014-06-20 11:08:35 +08:00
ridiculousfish
3bc2dda00d Merge branch 'death_of_fishd'
Incorporates more removal and cleanup of fishd remnants.
2014-06-18 11:19:28 -07:00
ridiculousfish
ee8e9c0291 Remove env_universal.h and env_universal.cpp from project 2014-06-18 10:14:35 -07:00
David Adam
f4bc1ef4a2 docs: clarify fish_greeting function and variable in FAQ
Tidy fish_greeting section in main documentation.

Closes #1506.
2014-06-18 17:29:59 +08:00
ridiculousfish
3513ce3ac0 Universal variable callbacks should only be announced for changed
values, not every value. Also support erase notifications.
2014-06-16 12:27:28 -07:00
ridiculousfish
6277a2e4a4 Migrate global functions out of env_universal. Have env operate directly
on an env_universal_t.
2014-06-15 17:30:50 -07:00
ridiculousfish
84faa60c4e Fix Linux build of env_universal_common 2014-06-13 15:35:37 -07:00
ridiculousfish
735195e8ea Teach env_universal_remove to directly report whether the variable was
successfully removed.
2014-06-13 15:15:11 -07:00
Konrad Borowski
0f15ab8d05 Allow fast failure on Travis. 2014-06-11 20:44:41 +02:00
ridiculousfish
17c2d76c5e Removed connection_t and associated functions 2014-06-09 16:41:10 -07:00
ridiculousfish
11c1562512 Remove connection_t usage from write_to_fd 2014-06-09 12:57:44 -07:00
ridiculousfish
ef646f0f78 Removal of more fishd artifacts and headers 2014-06-09 12:07:40 -07:00
Siteshwar Vashisht
7b3132d39d Fixed code to parse bindings for webconfig 2014-06-08 16:05:00 +05:30
ridiculousfish
8345fc2b9e Fix indentation 2014-06-07 23:27:06 -07:00
Arjun AK
58f4182880 Fixes issue:1484
Make jobs builtin return 1 if there are no jobs running in the background
2014-06-08 11:25:37 +05:30
ridiculousfish
ecf56606dc Remove large parts of fishd interaction, including
env_universal_server
2014-06-06 10:34:42 -07:00
ridiculousfish
be3e64e5ea Remove fishd.cpp source, docs, and target from Makefile and Xcode
project
2014-06-05 11:49:05 -07:00
mehultikekar
741342ba1d Fix Makefile.in for building key_reader 2014-06-01 15:58:08 -04:00
Konrad Borowski
d97e31b4ab git prompt shouldn't export variables. 2014-06-01 09:39:28 +02:00
ridiculousfish
ce4081af93 Fix some warnings in Linux build 2014-05-31 13:46:28 -07:00
ridiculousfish
32f5edc9c5 Do not continue execution if argument expansion fails. Fixes #1488 2014-05-31 12:41:27 -07:00
Konrad Borowski
b481128a93 Fix small misspelling in comment in expand.cpp 2014-05-31 09:08:46 +02:00
ridiculousfish
ab62001b74 Implement correct error message for failed process expansion. 2014-05-30 13:50:13 -07:00
ridiculousfish
2dfd57bb8c Hopeful fix for hangs in iothread tests in travis-ci 2014-05-29 13:44:31 -07:00
ridiculousfish
20d7a142c5 Enable fishd-less mode by default.
Shell instances now synchronize universal variables using the
filesystem. fishd should no longer be launched by default.
2014-05-29 13:05:47 -07:00