#14307 closed defect (fixed)
The new doctesting framework doesn't like being run with nohup
Reported by: | François Bissey | Owned by: | Minh Van Nguyen |
---|---|---|---|
Priority: | major | Milestone: | sage-5.9 |
Component: | doctest framework | Keywords: | |
Cc: | Jeroen Demeyer | Merged in: | sage-5.9.beta1 |
Authors: | Jeroen Demeyer | Reviewers: | François Bissey |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #12415 | Stopgaps: |
Description (last modified by )
When run inside nohup test are failing to run with the new doctesting framework in 5.9.beta0. An example
fbissey@QCD-nzi3 /home/work/fbissey/sandbox/sage-5.9.beta0 $ ./sage -t --long "devel/sage-main/sage/misc/inline_fortran.py" Running doctests with ID 2013-03-19-22-26-09-85e3b5eb. Doctesting 1 file. sage -t --long devel/sage-main/sage/misc/inline_fortran.py [10 tests, 1.1 s] ---------------------------------------------------------------------- All tests passed! ---------------------------------------------------------------------- Total time for all tests: 1.1 seconds cpu time: 0.1 seconds cumulative wall time: 1.1 seconds
But when the same thing is run with nohup
nohup ./sage -t --long "devel/sage-main/sage/misc/inline_fortran.py" &
The output is
Running doctests with ID 2013-03-19-22-26-21-d52d31ab. Doctesting 1 file. sage -t --long devel/sage-main/sage/misc/inline_fortran.py Process DocTestWorker-1: Traceback (most recent call last): File "/home/work/fbissey/sandbox/sage-5.9.beta0/local/lib/python/multiprocessing/process.py", l ine 258, in _bootstrap self.run() File "/home/work/fbissey/sandbox/sage-5.9.beta0/local/lib/python2.7/site-packages/sage/doctest/ forker.py", line 1655, in run sys.stdin = os.fdopen(0, "r") OSError: [Errno 22] Invalid argument Bad exit: 1 ********************************************************************** Tests run before process failed: ********************************************************************** ---------------------------------------------------------------------- sage -t --long devel/sage-main/sage/misc/inline_fortran.py # Bad exit: 1 ---------------------------------------------------------------------- Total time for all tests: 0.0 seconds cpu time: 0.0 seconds cumulative wall time: 0.0 seconds
This is with the following version of nohup
nohup --version nohup (GNU coreutils) 8.20 Packaged by Gentoo (8.20 (p1.0)) Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute
Attachments (1)
Change History (12)
comment:2 Changed 10 years ago by
nohup
is crazy. It opens the standard input for writing and claims it's a feature. From nohup
sources:
/* If standard input is a tty, replace it with /dev/null if possible. Note that it is deliberately opened for *writing*, to ensure any read evokes an error. */ if (ignoring_input) { if (fd_reopen (STDIN_FILENO, "/dev/null", O_WRONLY, 0) < 0) { error (0, errno, _("failed to render standard input unusable")); exit (exit_internal_failure); } if (!redirecting_stdout && !redirecting_stderr) error (0, 0, _("ignoring input")); }
comment:3 Changed 10 years ago by
Description: | modified (diff) |
---|
Updated the summary with nohup version as asked. Sounds crazy all right.
comment:4 Changed 10 years ago by
From the info page this is a GNU extension
If standard input is a terminal, it is redirected from `/dev/null' so that terminal sessions do not mistakenly consider the terminal to be used by the command. This is a GNU extension; programs intended to be portable to non-GNU hosts should use `nohup COMMAND [ARG]... </dev/null' instead.
I guess I will try the last bit.
comment:5 Changed 10 years ago by
Yes that's a cure
nohup ./sage -t --long "devel/sage-main/sage/misc/inline_fortran.py" </dev/null &
Does work as intended. I guess we can close this as invalid. I have just learnt about a GNU extension that has interesting side effects.
Changed 10 years ago by
Attachment: | 14307_bad_stdin.patch added |
---|
comment:6 Changed 10 years ago by
Authors: | → Jeroen Demeyer |
---|---|
Dependencies: | → #12415 |
Status: | new → needs_review |
It's also good anyway to fix the doctester to handle this case, needs review.
comment:7 Changed 10 years ago by
nohup
essentially does the equivalent of
./sage -t --long "devel/sage-main/sage/misc/inline_fortran.py" 0>/dev/null
which indeed fails without the patch and works with the patch.
comment:9 Changed 10 years ago by
Reviewers: | → François Bissey |
---|---|
Status: | needs_review → positive_review |
Works for me now with the patch. Thanks for the fix Jeroen!
comment:10 Changed 10 years ago by
Merged in: | → sage-5.9.beta1 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
comment:11 Changed 10 years ago by
Component: | doctest → doctest framework |
---|
Please add the output of