[ilugd] What happens in BASH when you do Ctrl-C (hint, it's not simply sending a SIGINT)
Hi all, I originally posted this question on stackoverflowhttp://stackoverflow.com/questions/6624622/what-happens-in-bash-when-you-do-ctrl-c-hint-its-not-simply-sending-a-sigint, but did not receive a satisfactory response. Any ideas? --8- A little background first - When I do apt-get install downloads from my company internet it provides a high burst of speed (400-500KB/s) for the first 10 seconds or so before dropping down to a tenth of that (40-50KB/s), and then after a few minutes to a truly miserable (4-5KB/s). This makes me think that the sysadmin has implemented some sort of a network throttling scheme. Now I know that the network is not simply erratic, because if I start an apt-get install foo, Ctrl-C it after 10 seconds and immediately run apt-get install foo again (by doing an up arrow and enter to use bash history), and then *keep repeating this process for a few minutes till all packages are downloaded*, I can download even large packages very fast. In particular, even after aborting a download with Ctrl-C, apt-get seems to be able to resume the download in the next invocation. Of course, staring at the screen doing Ctrl-C Up Enter every 10 seconds gets really boring real fast, so I wrote a shell script - #!/bin/sh for i in `seq 1 100` ; do sudo apt-get install foo -y sleep 10 sudo kill -2 $! done This seems to work. It spawns apt-get, runs it for 10 seconds and then kills (by sending a SIGINT) it and starts it up again. However, it doesn't really work because now apt-get does not resume downloads on subsequent invocations! An an experiment I ran sudo apt-get install foo from one terminal and then ran kill -2 PID of apt-get from another terminal. And even in that case, when I restart apt-get, it does not resume the download. So clearly a Ctrl-C is *not* equivalent to SIGINT. And something else is happening when I do Ctrl-C manually which gives apt-get a chance to save the state of the download. The question is - what is it? These are the suggestions I have received so far, but no cigars. The mystery deepens! - 1. On sudo kill -2 $! the signal might be going to sudo instead of apt-get. This is not the reason because as mentioned above I also tried sending SIGINT specifically to apt-get's PID and even that prevented apt-get from saving its state. 2. Sudo catches the signal and sends some other signal to apt-get. I tried sending apt-get all the signals I can think of! It still does not resume the download for any of them. It only resumes downloads when I do Ctrl-C to kill it. 3. Apt-get handles SIGINT differently if it is from a script instead of an interactive shell. Again, the experiment above proves that this is not true. --8- Thanks, Anupam Jain ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd
Re: [ilugd] What happens in BASH when you do Ctrl-C (hint, it's not simply sending a SIGINT)
On Fri, Jul 15, 2011 at 2:29 PM, Anupam Jain ajn...@gmail.com wrote: Hi all, I originally posted this question on stackoverflow http://stackoverflow.com/questions/6624622/what-happens-in-bash-when-you-do-ctrl-c-hint-its-not-simply-sending-a-sigint , but did not receive a satisfactory response. Any ideas? --8- A little background first - When I do apt-get install downloads from my company internet it provides a high burst of speed (400-500KB/s) for the first 10 seconds or so before dropping down to a tenth of that (40-50KB/s), and then after a few minutes to a truly miserable (4-5KB/s). This makes me think that the sysadmin has implemented some sort of a network throttling scheme. Now I know that the network is not simply erratic, because if I start an apt-get install foo, Ctrl-C it after 10 seconds and immediately run apt-get install foo again (by doing an up arrow and enter to use bash history), and then *keep repeating this process for a few minutes till all packages are downloaded*, I can download even large packages very fast. In particular, even after aborting a download with Ctrl-C, apt-get seems to be able to resume the download in the next invocation. Of course, staring at the screen doing Ctrl-C Up Enter every 10 seconds gets really boring real fast, so I wrote a shell script - #!/bin/sh for i in `seq 1 100` ; do sudo apt-get install foo -y sleep 10 sudo kill -2 $! done This seems to work. It spawns apt-get, runs it for 10 seconds and then kills (by sending a SIGINT) it and starts it up again. However, it doesn't really work because now apt-get does not resume downloads on subsequent invocations! An an experiment I ran sudo apt-get install foo from one terminal and then ran kill -2 PID of apt-get from another terminal. And even in that case, when I restart apt-get, it does not resume the download. So clearly a Ctrl-C is *not* equivalent to SIGINT. And something else is happening when I do Ctrl-C manually which gives apt-get a chance to save the state of the download. The question is - what is it? These are the suggestions I have received so far, but no cigars. The mystery deepens! - 1. On sudo kill -2 $! the signal might be going to sudo instead of apt-get. This is not the reason because as mentioned above I also tried sending SIGINT specifically to apt-get's PID and even that prevented apt-get from saving its state. 2. Sudo catches the signal and sends some other signal to apt-get. I tried sending apt-get all the signals I can think of! It still does not resume the download for any of them. It only resumes downloads when I do Ctrl-C to kill it. 3. Apt-get handles SIGINT differently if it is from a script instead of an interactive shell. Again, the experiment above proves that this is not true. --8- Heard of signal handlers? SIGINT (Ctrl-C) is trapped by libdpkg, which then performs cleanup and saves index state before exiting. apt-get is only a frontend for dpkg. http://osdir.com/ml/debian-dpkg-cvs/2011-01/msg00129.html Whether or not your downloads resume from last interrupted state depends on several factors, for example the size of package (if it's too small, it may be kept in tmpfs instead of /var/cache/apt/archive), or if the remote timestamp/checksum changes, or server may not support http-resume method for binaries, or if it's a source download; from man: Note that source packages are not tracked like binary packages, they exist only in the current directory and are similar to downloading source tar balls. Thanks, Anupam Jain ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd -- -- Ankit Chaturvedi GPG: 05DE FDC5 468B 7D9F 9F45 72F1 F7B9 9E16 ECA2 CC23 http://www.google.com/profiles/ankit.chaturvedi ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd
Re: [ilugd] What happens in BASH when you do Ctrl-C (hint, it's not simply sending a SIGINT)
On Fri, Jul 15, 2011 at 3:13 PM, Ankit Chaturvedi ankit.chaturv...@gmail.com wrote: On Fri, Jul 15, 2011 at 2:29 PM, Anupam Jain ajn...@gmail.com wrote: Hi all, I originally posted this question on stackoverflow http://stackoverflow.com/questions/6624622/what-happens-in-bash-when-you-do-ctrl-c-hint-its-not-simply-sending-a-sigint , but did not receive a satisfactory response. Any ideas? snip Heard of signal handlers? SIGINT (Ctrl-C) is trapped by libdpkg, which then performs cleanup and saves index state before exiting. apt-get is only a frontend for dpkg. You are misunderstanding the question. I know that something (I guess dpkg) catches the signal and then saves state. The question is why the same thing would not happen when I send SIGINT manually. The problem I am trying to solve is as follows - I would like to interrupt the apt-get install process *from a script* and then have it resume again. I assumed that sending a SIGINT would be exactly the same as a Ctrl-C. Apparently it's not. Why? -- AJ ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd
Re: [ilugd] Freed.in 2011/12 - Time to work
On Mon, Jul 11, 2011 at 12:43 AM, Vaidik Kapoor kapoor.vai...@gmail.com wrote: Minutes of the meeting are now available at http://www.lug-iitd.org/Freed.in_2011/2012#Minutes_of_the_Meeting [...] Thank you for doing that, and sorry for the delay in responding. It has been a rather hectic week. In the future, I would also request that we freeze meeting dates several days in advance to give people a chance to arrange schedules. Please also excuse the tl;dr. I am disturbed at some things that are noted in the minutes. I wish that I could have been at the meeting. Here are some notes on what is worrying me: * I think that the most important point that the people wanting to do this need to address is why do they want to take over Freed.in. Please do not see this as a dog-in-the-manger attitude: I would be most happy to see a new lease of life for Freed.in, but would question whether people have thought through the matter: - IMHO, the time is ripe for a new event in India that can take over what FOSS.in was doing in the last few years. However, such a developer-oriented event has been far from the focus of Freed.in, though Freedel was indeed close to this. IMHO, people should consider whether they want to revive Freedel rather than Freed.in.Or, start a new conference, hmm, let us call it maybe noname-conf? - My (again, very personal) opinion is that the FOSS developer community in India is not yet strong enough to support such an event, without adequate planning from the side of the organisers. This does not mean that such an event is not worth doing, but that it needs more of an organisational effort. * I am also surprised at the fact that people seem to be ready to jump into a major event without any lead-up. IMHO, a good plan would have been to start with smaller, more-focused events, which let the organisers gauge interest in such a developer-oriented event, and gain experience in organising events. Why does it seem that this was not even discussed? * One point, re an item in the minutes: Satyakam suggested that the reasons to have an event like Freed.in are different than the reasons that we are going to tell the prospective sponsors as sponsors are looking for benefits. Reasons like FOSS advocacy, etc. are not what they'll be interested in. I find this attitude unbelievable for people purportedly interested in freedom and openness, and I would also hope that the above was not the actual attitude. However, if true, I for one am going to be vehemently against such an event. Not to mince words, the above is basically lying to sponsors to get money, and at least IMHO, it would be better if Freed.in died rather than it morph into such an event. * I would also take issue with various reminiscences about Freed.in, as noted in the minutes, but that is not important right now, and I will approach the right people with a clue-bat in this regard. Regards, Gora ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd
Re: [ilugd] Invitation to connect on LinkedIn
Yogesh Singh via LinkedIn mem...@linkedin.com writes: LinkedIn Yogesh Singh requested to add you as a connection on LinkedIn: -- Vinay, nay. Nay. Vi - nay nay nay nay. hey; hey hey, nay nay hay. very idiotic neurotic asinine yokel. /me braces for a ban I'd like to add you to my professional network on LinkedIn. - Yogesh Accept invitation from Yogesh Singh http://www.linkedin.com/e/xrfxzz-gq5dvopu-4d/qWyQOxWKoBniiga-E9SHaxMCNW6ih6nQ4y5zLL81tR/blk/I153048778_25/1BpC5vrmRLoRZcjkkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYRcBYUdPsUd30Pdj59bRF9gTtDjQgUbPgTe3sVcP0RdjcLrCBxbOYWrSlI/EML_comm_afe/ View invitation from Yogesh Singh http://www.linkedin.com/e/xrfxzz-gq5dvopu-4d/qWyQOxWKoBniiga-E9SHaxMCNW6ih6nQ4y5zLL81tR/blk/I153048778_25/3kOnPwTdPwQc3cRckALqnpPbOYWrSlI/svi/ -- DID YOU KNOW you can use your LinkedIn profile as your website? Select a vanity URL and then promote this address on your business cards, email signatures, website, etc http://www.linkedin.com/e/xrfxzz-gq5dvopu-4d/ewp/inv-21/ -- Mahesh T. Pai || Sent from my Gooseberry. ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd
Re: [ilugd] Invitation to connect on LinkedIn
On Fri, Jul 15, 2011 at 10:20 PM, Yogesh Singh via LinkedIn mem...@linkedin.com wrote: LinkedIn [...] Oh, noes! Here we go again, complete with the mysterious Vinay. I will do my part of the kabuki theatre: http://wiki.linux-delhi.org/cgi-bin/twiki/view/Main/DoNotTrustMeWithYourPersonalData Even better, this bozo (and IMHO, this term is justified now), is already on the list. Regards, Gora ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd
Re: [ilugd] Invitation to connect on LinkedIn
So the mysterious again in picture. Well, why do not we all members check once in our address book for this Vinay, and delete his all existence. Regards, - Ravi Kumar On Fri, Jul 15, 2011 at 10:36 PM, Gora Mohanty g...@mimirtech.com wrote: On Fri, Jul 15, 2011 at 10:20 PM, Yogesh Singh via LinkedIn mem...@linkedin.com wrote: LinkedIn [...] Oh, noes! Here we go again, complete with the mysterious Vinay. I will do my part of the kabuki theatre: http://wiki.linux-delhi.org/cgi-bin/twiki/view/Main/DoNotTrustMeWithYourPersonalData Even better, this bozo (and IMHO, this term is justified now), is already on the list. Regards, Gora ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd ___ Ilugd mailing list Ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd