Commit Graph

119 Commits

Author SHA1 Message Date
Dylan Smith
364d3dbbf8 exec: Don't format status returned directly from builtin function
The builtin function returns the raw status, which is not the same as
the integer return by waitpid. Therefore, the WIF macros shouldn't be
used for checking or obtaining the status.

This bug can be seen by executing (eval false). The builtin eval
function returns 1, but proc_format_status misinterprets it as a signal
by checking WIFSIGNALED, so adds 128 to the status to return 129.

Signed-off-by: Grissiom <chaos.proton@gmail.com>
2010-11-24 00:27:16 +08:00
Grissiom
c6372a1b3f remove trailing spaces
This is done by `sed -i -e 's/[ \t]*$//' *.[c,h]`, which should not
introduce any functionality change.
2010-09-18 09:51:16 +08:00
axel
14c84ffbcb Check return value of a few write calls and retry on EINTR, and fix a few other warnings, mostly by printing error messages before giving up.
darcs-hash:20090222202852-ac50b-b0e79142af5b7a99e55271d4001fa252d9684a1d.gz
2009-02-23 06:28:52 +10:00
axel
f5be301a2f Handle exit status of processes terminated by signals
darcs-hash:20090221164656-ac50b-7bcbf6cb0bb8384560fbf9bf1059480cb4089def.gz
2009-02-22 02:46:56 +10:00
axel
36c3bd4e8d Switch from ARG_MAX to getting value from sysconf, glibc no longer defines the latter. This was reported from Peter Alfredsen Matthew Wesley, among other people.
darcs-hash:20090201132329-ac50b-5b9d54731c2ea2da3868fd492e68628b7684bb76.gz
2009-02-01 23:23:29 +10:00
liljencrantz
f974c7c416 Improve error messages on failed execve calls a bit more
darcs-hash:20080116010454-75c98-883050bf00f10bdb205724d7d273f10e6f0a1065.gz
2008-01-16 11:04:54 +10:00
liljencrantz
87db9517e9 Add lots of new code comments.
darcs-hash:20080113164747-75c98-9d0cefd27be7aef7ba60772616d9da7e6bb52912.gz
2008-01-14 02:47:47 +10:00
Nicholas Burlett
564d19e3bd The ability to switch to sh for processing files starting with a ':' broke
recently, as the incorrect arguments were being passed to execve. The
function went through the trouble of creating the proper arguments, and
then failed to use them.

darcs-hash:20080104015631-2d839-1d79a7810fcc3e2a3788dabdbc22d13a4bd4f404.gz
2008-01-04 11:56:31 +10:00
liljencrantz
71c2cde390 Cleanup and improve the exit status numbers and the messages generated on error as well as make sure that keyboard shortcuts don't change the status
darcs-hash:20080108193145-75c98-56c8aa2dd081af643d206820aa36bf3b6e49e0f2.gz
2008-01-09 05:31:45 +10:00
liljencrantz
2160777d2f Implement non-clobbering file io. Use the >? operator for this for now.
darcs-hash:20071026184232-75c98-11edcbc7548c8ad3a2d4b648cb7ae18067569f02.gz
2007-10-27 04:42:32 +10:00
liljencrantz
e54ce9a147 Minor bug fix - the parse_util_set_argv function can trigger an event, hence signals have to be unblocked when it is called.
darcs-hash:20071015132006-75c98-4ec10e4e26ea63c86c57f7e1f24f3d0fc60995b5.gz
2007-10-15 23:20:06 +10:00
liljencrantz
36e08dc49e Make the maximum execve size test use sysconf. Create a fallback if sysconf is unavailable.
darcs-hash:20071015113936-75c98-078e9f8727e91d41fabc80827bf97c8e04dd97ba.gz
2007-10-15 21:39:36 +10:00
liljencrantz
dd02e96712 Second part of improved execve errors - this patch makes the memory limits nicely formated (e.g. 128kB instead of 136549 bytes).
darcs-hash:20071015095108-75c98-51c2ea6ab6edba5d1885eb5938f039054da775e2.gz
2007-10-15 19:51:08 +10:00
liljencrantz
4163040e56 First stab at better error reporting on too many arguments to execve.
darcs-hash:20071015093615-75c98-2137b887ca3c97bc3e4234e2fd14a1391b4cc85a.gz
2007-10-15 19:36:15 +10:00
liljencrantz
e55739296d Don't crash when trying to close fds for a builtin command
darcs-hash:20071005150106-75c98-292df3863252c1eebd5734a241a2d80e6883f65f.gz
2007-10-06 01:01:06 +10:00
liljencrantz
79ac330afb There code for detecting when a keepalive process was needed missed lots of cases. This should fix some issues. Both the keepalive code and the code for spawning fake processes for builtins should be rethought, though.
darcs-hash:20070924082144-75c98-ab62f758374952aa3b295af709d57931972f4683.gz
2007-09-24 18:21:44 +10:00
liljencrantz
e6764f3130 Improve commenting a bit
darcs-hash:20070924081823-75c98-20dee07adff34f2337c56b30f1e453cc38f40639.gz
2007-09-24 18:18:23 +10:00
liljencrantz
657e3f8147 Whitespace fixes, etc.
darcs-hash:20070922222041-75c98-5aeb13041abd7ca8f9989e209fbaa5441fa78756.gz
2007-09-23 08:20:41 +10:00
liljencrantz
1420744669 Fix rather large performance issue on systems with slow fork syscall - a fork was used whenever redirecting output to /dev/null and using a builtin, completely unneeded.
darcs-hash:20070921214955-75c98-b513df263751506e5e82f97eafa08041228bc8de.gz
2007-09-22 07:49:55 +10:00
liljencrantz
084c0c5f80 Correct minor typos, stupid error messages, indentation and drop unused variable.
darcs-hash:20070921140752-75c98-74318b9daffa071845187bcc0b72259ca37b7e18.gz
2007-09-22 00:07:52 +10:00
liljencrantz
151943f89e Indentation, typo and formating fixes. Very minor patch.
darcs-hash:20070908222453-75c98-2236d962f0c9016820063e871fbbeaa42f36ef22.gz
2007-09-09 08:24:53 +10:00
axel
d0585befb3 Make sure that io redirections are respected by the '.' builtin. This was not the case earlier, which caused various bugs, especially after eval was made into a function that internally used '.'
darcs-hash:20070425183002-ac50b-d7d93e3b74e7274fe3e0aad98e95dd608bb903ae.gz
2007-04-26 04:30:02 +10:00
axel
ee94424b0f Add the possibility for functions which do not shadow the arguments of the calling function
darcs-hash:20070422221033-ac50b-d9544c87d0ddab10f7f503b5a1707292f266efe4.gz
2007-04-23 08:10:33 +10:00
axel
c323fc226f Add support for changing token separator in command substitution. IT is not the first character of IFS, same as in various other shells
darcs-hash:20070422184956-ac50b-7e03b375feb9fd22e11aa7a7d8f8add8e3b717a5.gz
2007-04-23 04:49:56 +10:00
axel
4d6751c274 Allow named arguments to function instead of only $argv. Philip Ganchev once suggested this, and it was suggested again by Egil Möller.
darcs-hash:20070416200611-ac50b-5eb42c94a65a4e72cae12cd9c04424bdc3b2b4f8.gz
2007-04-17 06:06:11 +10:00
axel
e128fa1a8e Fix a bug where io redirection of builtins would not truncate files if the builtin did not produce any output
darcs-hash:20070324223430-ac50b-3f3d6fd35f5b82c59ecaa06b459fe2b61dc8f387.gz
2007-03-25 08:34:30 +10:00
axel
8176a1253b Do not use stdout to report errors when stderr is dead - take the hint instead...
darcs-hash:20070121152242-ac50b-3e192328959cf65f03756b3bfbb794fb43dccead.gz
2007-01-22 01:22:42 +10:00
axel
4f67c38777 Use constant instead of hardcoded value for sleeptime on failed fork call
darcs-hash:20070121152026-ac50b-1daaac921f31dd10b2646d51b65af5260890d291.gz
2007-01-22 01:20:26 +10:00
axel
86beb7b109 Minor code simplification in exec.c
darcs-hash:20070121151943-ac50b-d913d1b205443cdf40a83a1d001e4d7a114c6e0c.gz
2007-01-22 01:19:43 +10:00
axel
98a6c491b1 Print stack trace when execting due to fatal problem or bug
darcs-hash:20070121150341-ac50b-66b86014963568bf402a76d5beb7c1d4e188c5f7.gz
2007-01-22 01:03:41 +10:00
axel
66c045c439 Minor code edits. Add curly brackets in various places, add or rewrite various comments, fix indentation, etc.
darcs-hash:20070121150114-ac50b-4fd6965cb2c557178923f8afa944835166e08423.gz
2007-01-22 01:01:14 +10:00
axel
a1ec38f53b Check error code when writing output from builtins - try to report errors
darcs-hash:20070121145810-ac50b-46ecb601ce9f0d862f00e4a97f25b6034e52f4cc.gz
2007-01-22 00:58:10 +10:00
axel
0469d05447 Make it possible to buffer input to other file descriptors than stdin. It is still only possible to buffer input on a single descriptor to any given job.
darcs-hash:20070107141052-ac50b-561265cd5acde7d882e4506870f13d61d34b3734.gz
2007-01-08 00:10:52 +10:00
axel
2fcec27e23 Make sure errno is not changed when error reporting after a failed call to execve
darcs-hash:20070107140918-ac50b-35186f2300d6ec03dbeac2cb5d5ffcee3feffc4e.gz
2007-01-08 00:09:18 +10:00
axel
42d0283489 Fix bug in IO redirection making is possible for the IO redirections to fail in cases where there are multiple pipes and buffers using file descriptors above 2.
darcs-hash:20070107140646-ac50b-dee4f380320ef2743635e77401a789c28d45f805.gz
2007-01-08 00:06:46 +10:00
axel
edc20a7505 Update to the ':' patch by Nicholas Burlett. This patch makes sure that ':' style executing of a command is only performed if a regular call to execve fails. This should improve performance a mall bit in the common case.
darcs-hash:20061211190308-ac50b-d284fa30c8c633816898141b644bd3039f80cc62.gz
2006-12-12 05:03:08 +10:00
nickburlett
23759e6eca colon-command support
Shells such as bash, sh, tcsh, and ksh each support a "colon command" that causes the script to be
evaluated as a bourne script. In the case of bash and sh, this command is a no-op. For others,
it means the script has sh syntax.

To suppor this in fish, I've added code to launch_process that checks for a ':' as the first
character of p->actual_cmd. If it is a colon, the process descriptor is modified to call
/bin/sh, which should exist on any POSIX system.

darcs-hash:20061208220428-5830d-6bde4f1a3e8100296a60c21f9e47988e20688a77.gz
2006-12-09 08:04:28 +10:00
axel
1b71f91a01 Update documentation display code to run roff on the client system instead of pregenerating documentation and compiling it into program binaries
darcs-hash:20061117162438-ac50b-5c4c7f0bd8bf53a16e16ecfead9569e642b7160f.gz
2006-11-18 02:24:38 +10:00
axel
b139201a33 A few additional input checks, minor code simplifications, and some indentation/documentation fixes
darcs-hash:20061115133046-ac50b-a6145bd9a63b6667357cc3ec603e185696bf1951.gz
2006-11-15 23:30:46 +10:00
axel
946b5d1528 Remove getpgid prototype from exec.c - this prototype seems to be no longer missing
darcs-hash:20061115132959-ac50b-d163141db6ad824ea0f6788338ebcec5001cbf5b.gz
2006-11-15 23:29:59 +10:00
axel
d00bc973fe Use fcntl to automatically close fishd socken on exec instead of handling it manually
darcs-hash:20061115111857-ac50b-3e04a0bc16c8442bef02cf4a50777d4556b8eaa6.gz
2006-11-15 21:18:57 +10:00
axel
ec43090c16 Fix file descriptor leakage from completion pager
darcs-hash:20061112121613-ac50b-209d42c06401faf675ff123236823dcaa651d6f7.gz
2006-11-12 22:16:13 +10:00
axel
f83575f084 Make sure signals aren't blocked while autoloading, also add a few consistency checks to see that signals aren't blocked in critical places
darcs-hash:20061029210911-ac50b-50bec85c3d59d0332ba44f3ece1a012cdc3e8c4b.gz
2006-10-30 07:09:11 +10:00
axel
561ec7d5f5 Change the way the umask is used so that executable bits are ignored on file creation. Thanks to sqweek and Jamessan for explaining the issue.
darcs-hash:20061026151946-ac50b-3a55159343f1fe0a4edf3f077bcec8afd6f131f5.gz
2006-10-27 01:19:46 +10:00
axel
3a128e1484 Use bitset to implement flags for jobs instead of wasting a whole int for every flag
darcs-hash:20061025204759-ac50b-ea07caa30782a1ea02d2cd8aa7cbc94474047a10.gz
2006-10-26 06:47:59 +10:00
axel
4683f4c989 Fix a number of bugs found using the warnings generated by earlier patch
darcs-hash:20061019153603-ac50b-4efb1ad1fe2cbe693a921648a0616a3d258d7933.gz
2006-10-20 01:36:03 +10:00
axel
a074cd62bc Be more rigorous with the exit codes set by the parser and builtins
darcs-hash:20061009012102-ac50b-4f28c43dd1ccdcc04d1620a6da05218a99fd7337.gz
2006-10-09 11:21:02 +10:00
axel
00c25436d7 Make it possible to save a function when defining it using the -S switch
darcs-hash:20060908141241-ac50b-69a055a1e791e04e2b1208a5c36b9bb22c854c12.gz
2006-09-09 00:12:41 +10:00
axel
1c86395ed8 Fix bug reportad by Martin Bähr that causes fish fail when using blocks in pipelines in interactive mode.
darcs-hash:20060827005252-ac50b-09c98537b9de72f0d4a2e5a28490b2e38fe321c8.gz
2006-08-27 10:52:52 +10:00
axel
480a29594e Minor tweaks to previous fish_pager patch to fix two bugs
darcs-hash:20060822135815-ac50b-35d9f643385ec29f9d8f93ca83d01e060de93cc7.gz
2006-08-22 23:58:15 +10:00