Hi,
I'm writing to you guys to see if you can shed some light on a strange
problem I have. I'm not sure if it's a stg problem, a git problem or a
person-behind-the-keyboard problem...

On my system;

[baymanix@tesla ~]$ cat /etc/issue
Fedora release 19 (Schrödinger’s Cat)
[baymanix@tesla ~]$ /usr/bin/stg --version
Stacked GIT 0.16
git version 1.8.3.1
Python version 2.7.5 (default, Nov 12 2013, 16:18:42)
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)]

(this is the updated stg I also tried with)
[baymanix@tesla ~]$ ~/bin/stg --version
Stacked GIT 0.17.1-dirty
git version 1.8.3.1
Python version 2.7.5 (default, Nov 12 2013, 16:18:42)
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)]

I have the strange problem of stg not returning to the prompt on some
commands. Running the commands on Emacs works fine, at least I havent
noticed anything. But on command line I get this behaviour:
stg series - returns fine
stg show - prints stuff and when I hit 'q' to exit less, I get stuck,
i.e. I have to hit Ctrl-C to get back to the prompt.
stg branch <branch> - same as show, executes the switch but does not
return to a prompt when done.

For the stg branch example, here's some output from stg 0.17.1 (with
log_mode = debug), with some additional printouts that I put there:
[baymanix@tesla git-stuff]$ stg branch prompt-location
Running subprocess ['git', 'config', '--null', '--list'] ... done
(return code: 0)
Running subprocess ['git', 'rev-parse', '--git-dir'] ... done (return code: 0)
Running subprocess ['git', 'rev-parse', '--git-dir'] ... done (return code: 0)
Running subprocess ['git', 'symbolic-ref', '-q', 'HEAD'] ...
  GIT_DIR: .git
done (return code: 0)
Running subprocess ['git', 'show-ref'] ...
  GIT_DIR: .git
done (return code: 0)
Running subprocess ['git', 'ls-tree', '-z',
'135065df162d665ea35e1cbccb114a3f77a9839b'] ...
  GIT_DIR: .git
done (return code: 0)
Running subprocess ['git', 'rev-parse', '--is-inside-work-tree'] ...
done (return code: 0)
Running subprocess ['git', 'rev-parse', '--show-cdup'] ... done (return code: 0)
Running subprocess ['git', 'symbolic-ref', '-q', 'HEAD'] ... done
(return code: 0)
Running subprocess ['git', 'rev-parse', '--git-dir'] ... done (return code: 0)
Running subprocess ['git', 'rev-parse', '--git-dir'] ... done (return code: 0)
stg branch: Branch "prompt-location" is already the current branch
git.py:CatFileProcess:__shutdown calling os.kill 21818
git.py:CatFileProcess:__shutdown calling p.wait 21818
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/baymanix/lib/python2.7/site-packages/stgit/lib/git.py",
line 585, in __shutdown
    p.wait()
  File "/usr/lib64/python2.7/subprocess.py", line 1357, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib64/python2.7/subprocess.py", line 478, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/baymanix/lib/python2.7/site-packages/stgit/lib/git.py",
line 585, in __shutdown
    p.wait()
  File "/usr/lib64/python2.7/subprocess.py", line 1357, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib64/python2.7/subprocess.py", line 478, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt

"strace stg branch prompt-location":
fstat(10, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7f6ee3216000
lseek(10, 0, SEEK_CUR)                  = -1 ESPIPE (Illegal seek)
fstat(10, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
munmap(0x7f6ee3216000, 4096)            = 0
close(6)                                = 0
poll([{fd=8, events=POLLIN|POLLPRI}, {fd=10, events=POLLIN|POLLPRI}],
2, 4294967295) = 2 ([{fd=8, revents=POLLIN|POLLHUP}, {fd=10,
revents=POLLHUP}])
read(8, ".git\n", 4096)                 = 5
close(10)                               = 0
poll([{fd=8, events=POLLIN|POLLPRI}], 1, 4294967295) = 1 ([{fd=8,
revents=POLLHUP}])
close(8)                                = 0
wait4(21860, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 21860
write(1, "done (return code: 0)\n", 22done (return code: 0)
) = 22
stat(".git/patches/prompt-location/hidden", {st_mode=S_IFREG|0644,
st_size=0, ...}) = 0
brk(0)                                  = 0x18ee000
brk(0x190f000)                          = 0x190f000
write(2, "stg branch: Branch \"prompt-locat"..., 66stg branch: Branch
"prompt-location" is already the current branch) = 66
write(2, "\n", 1
)                       = 1
write(1, "git.py:CatFileProcess:__shutdown"...,
55git.py:CatFileProcess:__shutdown calling os.kill 21854
) = 55
kill(21854, SIGTERM)                    = 0
write(1, "git.py:CatFileProcess:__shutdown"...,
54git.py:CatFileProcess:__shutdown calling p.wait 21854
) = 54
wait4(21854,

It seems stg is waiting for git to quit, and doing an attached strace
for the git process stg is waiting for yields:

[baymanix@tesla]$ strace -p 21896
Process 21896 attached
read(0,

So for some reason, git is waiting for more input. If I add this line,
the problem (of course) goes away:

[baymanix@tesla stgit-0.17.1]$ diff -u stgit/lib/git.py stgit/lib/git.py.sima
--- stgit/lib/git.py    2014-02-12 15:40:04.775543849 +0100
+++ stgit/lib/git.py.sima    2014-02-12 15:39:06.934818420 +0100
@@ -579,6 +579,7 @@
         p = self.__proc
         if p:
             print "git.py:CatFileProcess:__shutdown calling os.kill", p.pid()
+            p.stdin.close()
             os.kill(p.pid(), signal.SIGTERM)
             print "git.py:CatFileProcess:__shutdown calling p.wait", p.pid()
             p.wait()

Any idea to why this is happening?
Have I messed something up on my system or is it a bug?

Thanks nonetheless for a great utility! I've had a much better
experience with git after starting to use stg on top of it =)

-Sima

_______________________________________________
stgit-users mailing list
[email protected]
https://mail.gna.org/listinfo/stgit-users

Reply via email to