Adam Cozzette
e9d1a54983
fix: Fish may hang in Linux virtual console
...
I find that if I have a config.fish consisting of the following two
lines
status --job-control full
. empty.fish
where empty.fish is just an empty file in ~/.config/fish, Fish will
hang when I attempt to log in on a virtual console (e.g. tty1). If I run
Fish within X11 or with either of those lines commented out,
everything's fine. I think the second line can be any command that cause
Fish to perform a fork().
The fix is pretty simple and just involves replacing getpid() with
getpgrp() in terminal_return_from_job in proc.c. See below for the
detailed explanation. I'm certainly no expert so I would appreciate it
if anyone else can confirm that my fix looks ok.
Here's what causes the bug as far as I can tell:
1. When I login on a virtual console, /bin/login calls Fish. When Fish
begins executing its process group and the process group controlling the
terminal are both the pid of the /bin/login process.
2. The ". empty.fish" line causes Fish to fork a new process. The new
process creates a new process group and takes control of the terminal
under the name of that process group.
3. When the child process finishes, the parent prcoess attempts to take
back control of the terminal by setting its controlling process group id
to be its pid.
4. Now there is a mismatch between the process group id of the Fish
shell (= the pid of the /bin/login process) and the process group id
controlling the terminal (= the pid of the Fish shell).
reader_interactive_init detects the mismatch and it thinks that it
doesn't have control of the terminal, so it hangs as it waits for
control.
My fix just solves the problem in step 3 by having the parent process
correctly reassign control of the terminal to its process group.
Signed-off-by: Grissiom <chaos.proton@gmail.com>
2011-07-28 09:50:39 +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
Ben Hoskings
6b8e7b16f6
Reduced timeout in select_try() from 5s to 10ms.
2010-04-09 15:56:09 -07: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
liljencrantz
394776c56b
Update todo list and code comments
...
darcs-hash:20080109012338-75c98-745297861fd11ec82e062a79fe1d15c9084342f1.gz
2008-01-09 11:23:38 +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
axel
5c9570eb56
Minor code tweaks
...
darcs-hash:20070416201053-ac50b-99d3ee51ef2b3642c737c3809bc2a4bfbe103b67.gz
2007-04-17 06:10:53 +10:00
axel
bc1efb1556
Minor code edit - move a bit of code into its own function
...
darcs-hash:20061120131224-ac50b-974496cc800377e4e06475491f89998b9640fbba.gz
2006-11-20 23:12:24 +10:00
axel
dd061b1dda
Minor comment edits and removal of a warning
...
darcs-hash:20061118212459-ac50b-d6f4dddb560b4815ca850f9e9c3e8d7a5cf5ea70.gz
2006-11-19 07:24:59 +10:00
axel
5f69f2bb0c
Make fish send a HUP signal to jobs when the terminal tells it to exit.
...
darcs-hash:20061111104840-ac50b-ae989e26bdb6c769ed93dcf11b742887c97858aa.gz
2006-11-11 20:48:40 +10:00
axel
13a85ee3f1
Make sure fish has the currect exit status
...
darcs-hash:20061102134859-ac50b-692f9e9aff838ea375e5cf29eeae1e29b1b75338.gz
2006-11-02 23:48:59 +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
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
53ea5d60b7
Minor code tweaks, mostly things like indentation, but also a ferw code reorderings
...
darcs-hash:20060828120244-ac50b-ad4be149ff245b6f799452f9eeff7bcc60af1526.gz
2006-08-28 22:02:44 +10:00
axel
41f8007a03
More header/autoconf fixes, improve winsize checking
...
darcs-hash:20060809225338-ac50b-7162a690e44e2272f4760723f5bf8cc135dc5952.gz
2006-08-10 08:53:38 +10:00
axel
0e1a3c7c4a
Add missing sys/select.h header needed on FreeBSD
...
darcs-hash:20060809222605-ac50b-7914c1eb0509a01bfb6d07a04e29e126218f89dc.gz
2006-08-10 08:26:05 +10:00
axel
d1bbb89389
Move over a few more objects to the new array_list functions
...
darcs-hash:20060731165511-ac50b-7858829e6a612e0c737d82d3d71d6833dc97f078.gz
2006-08-01 02:55:11 +10:00
axel
60f0533821
Include siginfo.h in all signal-using files to make Solaris happy. Thanks to Netocrat for the report and a description of the solution.
...
darcs-hash:20060730202659-ac50b-1840aff40ec2467242bd107676c7426cdb14f643.gz
2006-07-31 06:26:59 +10:00
axel
b2e2743195
Remove translate.c. The gettext fallback functionality is moved to fallback.c, the wide wrapper is moved to wutil.c
...
darcs-hash:20060719225549-ac50b-0a55e805b04f4fe0afa99ea580901d62f39cdef5.gz
2006-07-20 08:55:49 +10:00
axel
9830bf985a
Fix psub deadlocks by once again considering a job as completed whenever the last process in the pipeline is dead
...
darcs-hash:20060707153539-ac50b-76842c851c3a4247c086e3242f70361b9d2d396b.gz
2006-07-08 01:35:39 +10:00
axel
3ddd5e5981
Check exit status of close and fclose in a few extra places
...
darcs-hash:20060621095430-ac50b-52afcee91b856f706d6df6bcf2e3a6bc7d746e40.gz
2006-06-21 19:54:30 +10:00
axel
5688035680
Large number of sourcecode comment edits, and some minor code polish
...
darcs-hash:20060620005010-ac50b-eaeae9a6242a37c1e34831e1a0b2ee2b4e7a012e.gz
2006-06-20 10:50:10 +10:00
axel
0361423469
Major restructuring of the buildsystem, meaning that the documentation doesn't needlessly rebuild itself, and the size of the fish binary drops slightly
...
darcs-hash:20060613134328-ac50b-05ae75eb5cc081b680f38e8866fac00a679cc266.gz
2006-06-13 23:43:28 +10:00
axel
d690a15b29
Make job id numbering start from 1, not 0
...
darcs-hash:20060428132137-ac50b-8e5adcdbc18ad7627b66e9129a13b037a669dd02.gz
2006-04-28 23:21:37 +10:00
axel
0de232bf54
Do not return to the shell until all processes of a job have finished (Previous behaviour was to return once the last job had exited, and could cause e.g. the jobs builtin to print out the job responsible for repainting the titlebar). Also validate that jobs have not completed in various places where the job list is examined
...
darcs-hash:20060404112722-ac50b-4b6a55ce7c57d39213cdd0ed0f581795a72859b7.gz
2006-04-04 21:27:22 +10:00
axel
80b4055eab
Add support for the -n switch to skip execution of any commands
...
darcs-hash:20060318010459-ac50b-9d9e5c489e0e4df2159d8c1d0ff952d42e2a2a82.gz
2006-03-18 11:04:59 +10:00
axel
32b531667a
Fix bug that causing terminal corruption if a job is put under job control before running in interactive mode. This is fixed by doing more inits at startup (but only slightly more)
...
darcs-hash:20060310133809-ac50b-d31cd7bab1a3a58de2833f73735817a3d0b3ed7d.gz
2006-03-10 23:38:09 +10:00
axel
2401a163fe
Move all fallbacks for standard and not-so-standard unix functions to fallback.c, in order to have a one-stop place to look for such functions
...
darcs-hash:20060228131716-ac50b-0832193dbcaf7191dcb24456dc40f2e861a1382e.gz
2006-02-28 23:17:16 +10:00
axel
cc69afc4fe
Fix bug in fish causing occasionally incorrect signal handlers
...
darcs-hash:20060216133632-ac50b-f24c049830f9c6deca50aca640189ad3f87b630a.gz
2006-02-16 23:36:32 +10:00
axel
d1c9bca2e9
Another halloc:ification of fish. Halloc has been extended to allow registering function calls, this has allowed the creation of halloc-handled arraylists, stringbuffers, etc. More job parsing halloc-ification has reduced the error handling code to only a shadow of it's former self
...
darcs-hash:20060209155020-ac50b-e119c5293ce2368e252cfc01b98ab7c629fdd678.gz
2006-02-10 01:50:20 +10:00
axel
57d53c70e3
Further halloc:ification if fish
...
darcs-hash:20060206181101-ac50b-db0aac307a81e7f0677acd15a9f38ff8c7ff36d2.gz
2006-02-07 04:11:01 +10:00
axel
6291be256b
Second checkin of halloc changeover. Make the argv array, but not it's contents, be allocated using halloc. Also make list_to_char_arr use halloc
...
darcs-hash:20060206151817-ac50b-e8fd4cff831ee975c5bf3855d9ecfc15a3fb9215.gz
2006-02-07 01:18:17 +10:00
axel
585191310b
First checkin of transition to using a new hierarchical memory allocator, some of the memory associated with a job is covered
...
darcs-hash:20060206142502-ac50b-ba1c9a4f64ea0f44f65303a125f9ddae5bd31e2f.gz
2006-02-07 00:25:02 +10:00
axel
4f947015d2
Minor tweaks, including a few small performance improvements
...
darcs-hash:20060204130914-ac50b-331e83fd8fe472545fce60fc4b76bb8300526d64.gz
2006-02-04 23:09:14 +10:00
axel
ff00354305
Make sure completions aren't run in interactive mode
...
darcs-hash:20060204113433-ac50b-454170ab12fbbcec9cfb6615910b611c680fcc3d.gz
2006-02-04 21:34:33 +10:00
axel
feabc032f6
Generalize the stack tracing code, add support for showing events and command substitutions in stack traces
...
darcs-hash:20060201154911-ac50b-707358ea50231661c05a92b40ca109ec801081e6.gz
2006-02-02 01:49:11 +10:00
axel
e95effb043
Readd the terminal flag for jobs, as not all jobs under job control should be given the terminal.
...
darcs-hash:20060201122715-ac50b-7efc499e8905e9898c214816d0a3468e077c7005.gz
2006-02-01 22:27:15 +10:00
axel
f59e9baab9
Rename the 'terminal' flag to 'job_control', make sure fg and bg only considers jobs under job control and make it configurable which jobs are put under job control using the status builtin. Also add an option to the status builtin to print a stack trace.
...
darcs-hash:20060130175426-ac50b-46fb79797284cb600c67cb19462b53761446f00a.gz
2006-01-31 03:54:26 +10:00
axel
521d09b6d0
Add support for calculating completions for arbitrary commands through the 'complete' builtin
...
darcs-hash:20060130165150-ac50b-5e2ef3bb0298dd5e1a5d6fbdade314cc73ef36f3.gz
2006-01-31 02:51:50 +10:00
axel
29c488c6dc
Fixes to api documentation, added .PHONY to makefile actions, made a few private functions static
...
darcs-hash:20060123204014-ac50b-b9d2a10c7f00945b5d9d244cb3b8c1489fe280de.gz
2006-01-24 06:40:14 +10:00
axel
a47065f648
Add fallback implementations of wcstok, putwc and getwc. Move all fallbacks from common.c to wutil.c.
...
darcs-hash:20060120142721-ac50b-4b9850d889e2210e1d545339e29dcc038a3f2b04.gz
2006-01-21 00:27:21 +10:00
axel
1e7dd4f928
Check location of term.h header (updated)
...
darcs-hash:20060119122207-ac50b-c573f54cbe13a1592a20342ee331159be0306913.gz
2006-01-19 22:22:07 +10:00
axel
05736978bb
Change the foregrounf/background code a bit, fixes bug where mulktiple jobs want foreground status. Is this fix enough or are there still corner cases?
...
darcs-hash:20060118124248-ac50b-cbbddb8c6dad1f44826050395cda647fa9348f0f.gz
2006-01-18 22:42:48 +10:00
axel
5db192347c
Make sure all foreground jobs are reaped after evaluating a job to avoid things like 'sleep 10m; fg' don't try to restart sleep
...
darcs-hash:20060116001912-ac50b-30944d879d48b8b2714b24fa9a1e7f906ed3e1fb.gz
2006-01-16 10:19:12 +10:00
axel
18bbb5ad01
Put jobs in functions and block into their own process group in interactive mode, but do not put the 'fake jobs' associated with functions in a group
...
darcs-hash:20060116001556-ac50b-b91d6e45fe136874237ad31538de02b5e63a8bac.gz
2006-01-16 10:15:56 +10:00
axel
6a0460f51e
Do not use \r sequence in translatable messages
...
darcs-hash:20060105135411-ac50b-f19d697f1b3f32cd695ee52282fc4281248e213f.gz
2006-01-05 23:54:11 +10:00
axel
ec43c635cc
Add i18n through gettext, as well as a Swedish translation
...
darcs-hash:20060104125102-ac50b-5bf026578a69bd94f7a7a3c8dee0ebccd95e5c24.gz
2006-01-04 22:51:02 +10:00
axel
1d69e70b7a
Initial blocking implementation
...
darcs-hash:20051211222101-ac50b-6e11220bd608187fbb32a0313b5b73dbdc8354fc.gz
2005-12-12 08:21:01 +10:00
axel
32e833f331
Remove old event hooks, add more event handler documentation
...
darcs-hash:20051203194618-ac50b-e90683cb69b19da789152164a89a34bf187fd4e4.gz
2005-12-04 05:46:18 +10:00