Re: [fossil-users] Closing fossil output
Oh i see, thank you very much. Alysson Gonçalves de Azevedo Anarcho-syndicalism is a way of preserving freedom. - Monty Python 2014-08-11 18:08 GMT-03:00 Scott Robison sc...@casaderobison.com: On Mon, Aug 11, 2014 at 2:36 PM, Alysson Gonçalves de Azevedo agalys...@gmail.com wrote: I understand why one cannot open a database (or any other command) from descriptor file minor than 3. But why this `fossil branch 21` do work and `fossil branch 2-` doesn't, it's not clear. If i open a database using descriptor 3 and close stderr, does descriptor 3 becomes 2 ? I don't want bother anyone, i just asking because this is something new to me. Your guess is correct. Normally you have STDIN, STDOUT STDERR as fd 0, 1 2 respectively. By telling the shell to close / not open STDERR (2-) 2 becomes the next file descriptor and is used by the environment when SQLite opens one of the databases. SDR ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Closing fossil output
On Mon, Aug 11, 2014 at 2:46 PM, Alysson Gonçalves de Azevedo agalys...@gmail.com wrote: Hi guys. I'm making a script for bash and just found something strange. If i redirect fossil output to /dev/null, everything works fine. $ fossil branch /dev/null $ fossil branch 2 /dev/null trunk somebranch But if I close file descriptor http://www.tldp.org/LDP/abs/html/io-redirection.html, doesn't work. $ fossil branch - SQLITE_WARNING: attempt to open /mnt/dataExt/works/project/.fslckout as file descriptor 1 $ fossil branch 2- Does this happen only to me? That is by design, and it is for your protection. http://www.sqlite.org/compile.html#minimum_file_descriptor -- D. Richard Hipp d...@sqlite.org ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Closing fossil output
On Mon, Aug 11, 2014 at 9:16 PM, Richard Hipp d...@sqlite.org wrote: That is by design, and it is for your protection. http://www.sqlite.org/compile.html#minimum_file_descriptor @Alysson: the scenario described there actually happened to the main fossil repo. Luckily, it corrupted only one or two non-critical tables which could be rebuilt. -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do. -- Bigby Wolf ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Closing fossil output
Well, I don't really get, a closed file descriptor wouldn't cause corruption, would? btw, i'll use /dev/null. thanks Alysson Gonçalves de Azevedo Anarcho-syndicalism is a way of preserving freedom. - Monty Python 2014-08-11 16:19 GMT-03:00 Stephan Beal sgb...@googlemail.com: On Mon, Aug 11, 2014 at 9:16 PM, Richard Hipp d...@sqlite.org wrote: That is by design, and it is for your protection. http://www.sqlite.org/compile.html#minimum_file_descriptor @Alysson: the scenario described there actually happened to the main fossil repo. Luckily, it corrupted only one or two non-critical tables which could be rebuilt. -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do. -- Bigby Wolf ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Closing fossil output
On Mon, Aug 11, 2014 at 1:33 PM, Alysson Gonçalves de Azevedo agalys...@gmail.com wrote: Well, I don't really get, a closed file descriptor wouldn't cause corruption, would? btw, i'll use /dev/null. It wouldn't cause corruption in and of itself, but once you close a file descriptor, it becomes available for use in a future open operation. If you close stderr (descriptor 2) and then a database file is opened as descriptor 2, anyone who assumes descriptor 2 is always stderr is going to write textual data to a non-terminal / non-text file. The fact that descriptor 2 was closed isn't the problem, it is the assumption that descriptor 2 will always be stderr that is the problem. SDR ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Closing fossil output
I understand why one cannot open a database (or any other command) from descriptor file minor than 3. But why this `fossil branch 21` do work and `fossil branch 2-` doesn't, it's not clear. If i open a database using descriptor 3 and close stderr, does descriptor 3 becomes 2 ? I don't want bother anyone, i just asking because this is something new to me. Thanks in advance, Alysson Gonçalves de Azevedo Anarcho-syndicalism is a way of preserving freedom. - Monty Python 2014-08-11 16:41 GMT-03:00 Scott Robison sc...@casaderobison.com: On Mon, Aug 11, 2014 at 1:33 PM, Alysson Gonçalves de Azevedo agalys...@gmail.com wrote: Well, I don't really get, a closed file descriptor wouldn't cause corruption, would? btw, i'll use /dev/null. It wouldn't cause corruption in and of itself, but once you close a file descriptor, it becomes available for use in a future open operation. If you close stderr (descriptor 2) and then a database file is opened as descriptor 2, anyone who assumes descriptor 2 is always stderr is going to write textual data to a non-terminal / non-text file. The fact that descriptor 2 was closed isn't the problem, it is the assumption that descriptor 2 will always be stderr that is the problem. SDR ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Closing fossil output
On Mon, Aug 11, 2014 at 2:36 PM, Alysson Gonçalves de Azevedo agalys...@gmail.com wrote: I understand why one cannot open a database (or any other command) from descriptor file minor than 3. But why this `fossil branch 21` do work and `fossil branch 2-` doesn't, it's not clear. If i open a database using descriptor 3 and close stderr, does descriptor 3 becomes 2 ? I don't want bother anyone, i just asking because this is something new to me. Your guess is correct. Normally you have STDIN, STDOUT STDERR as fd 0, 1 2 respectively. By telling the shell to close / not open STDERR (2-) 2 becomes the next file descriptor and is used by the environment when SQLite opens one of the databases. SDR ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users