threads / patch / 11957

patchgit help -w should not create nohup.out

Subject: [PATCH] git help -w should not create nohup.out

## tl;dr

11 messages between Feb 8, 2008 and Feb 10, 2008. Diffs are folded; open one to read it.

replies: 10people: 4as markdown or json

Dmitry Potapov· Feb 8, 2008, 01:33 UTC · lore

git-help--browse uses 'nohup' to launch some browsers. If the output is not redirected, 'nohup' creates 'nohup.out' and prints a warning about that. It was mighty annoying to see this warning as well as to have empty nohup.out files scattered everywhere you happened to use 'git help -w'.

This patch redirects the output to /dev/null when a GUI browser is launched using the 'nohup' command; thus 'nohup.out' is not created.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---

Initially I thought to redict the output to $HOME/.git-nohup.out instead of /dev/null, so no output will be lost if an error happen. But the only error that a GUI browser may want to report to the stderr or stdout is a problem inside Xlib (like connection to X display or something like that), and when it happens you cannot run your favorite browser from the command line anyway. So, it is very noticeably and no problem to diagnose without any nohup.out created by git help.

 git-help--browse.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Show changes to git-help--browse.sh +3 −3
diff --git a/git-help--browse.sh b/git-help--browse.sh
index 10b0a36..320e836 100755
--- a/git-help--browse.sh
+++ b/git-help--browse.sh
@@ -122,7 +122,7 @@ case "$browser" in
 	vers=$(expr "$($browser_path -version)" : '.* \([0-9][0-9]*\)\..*')
 	NEWTAB='-new-tab'
 	test "$vers" -lt 2 && NEWTAB=''
-	nohup "$browser_path" $NEWTAB $pages &
+	nohup "$browser_path" $NEWTAB $pages > /dev/null &
 	;;
     konqueror)
 	case "$(basename "$browser_path")" in
@@ -136,7 +136,7 @@ case "$browser" in
 		eval "$browser_path" newTab $pages
 		;;
 	    *)
-	        nohup "$browser_path" $pages &
+	        nohup "$browser_path" $pages > /dev/null &
 		;;
 	esac
 	;;
@@ -144,6 +144,6 @@ case "$browser" in
 	eval "$browser_path" $pages
 	;;
     dillo)
-	nohup "$browser_path" $pages &
+	nohup "$browser_path" $pages > /dev/null &
 	;;
 esac
-- 
1.5.4
Johannes Schindelin· Feb 8, 2008, 01:55 UTC · re: Dmitry Potapov · lore

Re: [PATCH] git help -w should not create nohup.out

Hi,
On Fri, 8 Feb 2008, Dmitry Potapov wrote:
> git-help--browse uses 'nohup' to launch some browsers.
Why?

"nohup" should be used to start a program that should persist even after you logged out. I fail to see how this should be sensible for "git help -w". So "off with the head", uh, do away with the "nohup", I say!

Ciao, Dscho

Junio C Hamano· Feb 8, 2008, 03:40 UTC · re: Johannes Schindelin · lore

Re: [PATCH] git help -w should not create nohup.out

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 11 quoted lines
> Hi,
>
> On Fri, 8 Feb 2008, Dmitry Potapov wrote:
>
>> git-help--browse uses 'nohup' to launch some browsers.
>
> Why?
>
> "nohup" should be used to start a program that should persist even after 
> you logged out.  I fail to see how this should be sensible for "git help 
> -w".  So "off with the head", uh, do away with the "nohup", I say!

True. Christian, what was the reason you added nohup? I would imagine if you did this:

	(1) open a new xterm;
        (2) in that xterm, run the browser, perhaps from
            git-help--browse, but without nohup, in the
            background;
	(3) exit the terminal

then the browser might get upset, losing its controlling terminal.

But I suspect that would be a really broken behaviour.
Christian Couder· Feb 8, 2008, 05:37 UTC · re: Junio C Hamano · lore

Re: [PATCH] git help -w should not create nohup.out

Le vendredi 8 février 2008, Junio C Hamano a écrit :
Show 14 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> > Hi,
> >
> > On Fri, 8 Feb 2008, Dmitry Potapov wrote:
> >> git-help--browse uses 'nohup' to launch some browsers.
> >
> > Why?
> >
> > "nohup" should be used to start a program that should persist even
> > after you logged out.  I fail to see how this should be sensible for
> > "git help -w".  So "off with the head", uh, do away with the "nohup", I
> > say!
>
> True.  Christian, what was the reason you added nohup?
I think I was worried about something like this:
1) ssh -Y other_machine
2) git help -w, it opens my browser
3) open many other tabs in the browser
4) exit other_machine, oops my browser with all my tabs is gone
or
1) open my favorite browser and many tabs in it
2) ssh -Y other_machine
3) git help -w, cool it opens a tab in my already opened browser in 1)
4) exit other_machine, oops my browser with all my tabs is gone

I thought it would perhaps help, and it was better to be on the safe side. But I just tested a little and it seems it doesn't change anything.

Also there are some browser that are very verbose on the SDTOUT or STDERR (especially konqueror) and I thought the nohup would also help move the output out of the command line while not discarding it in case it's needed. But I agree that it's not very often usefull and anyway there are better ways to deal with it.

So no problem to do away with the "nohup".

Thanks, Christian.

Dmitry Potapov· Feb 8, 2008, 11:25 UTC · re: Christian Couder · lore

Re: [PATCH] git help -w should not create nohup.out

On Fri, Feb 08, 2008 at 06:37:03AM +0100, Christian Couder wrote:
Show 7 quoted lines
> 
> I think I was worried about something like this:
> 
> 1) ssh -Y other_machine
> 2) git help -w, it opens my browser
> 3) open many other tabs in the browser
> 4) exit other_machine, oops my browser with all my tabs is gone

It seems to me that the browser will be killed anyway if ssh connection is closed. At least, that what happened when I used ssh -Y localhost. In fact, "nohup" made only easier to kill the browser in this way: ssh -Y localhost git help -w exit CTRL-C

Without "nohup" CTRL-C had no effect, but when I started the browser with nohup then the connection would be closed and the browser killed.

Dmitry
Dmitry Potapov· Feb 8, 2008, 10:33 UTC · re: Junio C Hamano · lore

Re: [PATCH] git help -w should not create nohup.out

On Thu, Feb 07, 2008 at 07:40:21PM -0800, Junio C Hamano wrote:
Show 27 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Hi,
> >
> > On Fri, 8 Feb 2008, Dmitry Potapov wrote:
> >
> >> git-help--browse uses 'nohup' to launch some browsers.
> >
> > Why?
> >
> > "nohup" should be used to start a program that should persist even after 
> > you logged out.  I fail to see how this should be sensible for "git help 
> > -w".  So "off with the head", uh, do away with the "nohup", I say!
> 
> True.  Christian, what was the reason you added nohup?
> I would imagine if you did this:
> 
> 	(1) open a new xterm;
> 
>         (2) in that xterm, run the browser, perhaps from
>             git-help--browse, but without nohup, in the
>             background;
> 
> 	(3) exit the terminal
> 
> then the browser might get upset, losing its controlling
> terminal.

I also thought so, therefore, I suggested to redict the output to /dev/null instead of removing "nohup", but now after some testing, it seems there is no need for "nohup" here. So, unless Christian has a good reason for "nohup", I agree with Johannes that "nohup" should be removed.

Dmitry
Dmitry Potapov· Feb 8, 2008, 20:36 UTC · re: Junio C Hamano · lore

[PATCH] remove "nohup" from git-help--browse

There is no good reason to run GUI browsers using "nohup". It does not solve any real problem but creates annoying "nohup.out" files in every directory where git help -w is run.

This patch removes "nohup" from git-help--browse.sh
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---
It seems that everyone is agree that there is no good reason to
keep "nohup" in git-help--browse. So here is the patch.
 git-help--browse.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Show changes to git-help--browse.sh +3 −3
diff --git a/git-help--browse.sh b/git-help--browse.sh
index 10b0a36..adc4d37 100755
--- a/git-help--browse.sh
+++ b/git-help--browse.sh
@@ -122,7 +122,7 @@ case "$browser" in
 	vers=$(expr "$($browser_path -version)" : '.* \([0-9][0-9]*\)\..*')
 	NEWTAB='-new-tab'
 	test "$vers" -lt 2 && NEWTAB=''
-	nohup "$browser_path" $NEWTAB $pages &
+	"$browser_path" $NEWTAB $pages &
 	;;
     konqueror)
 	case "$(basename "$browser_path")" in
@@ -136,7 +136,7 @@ case "$browser" in
 		eval "$browser_path" newTab $pages
 		;;
 	    *)
-	        nohup "$browser_path" $pages &
+	        "$browser_path" $pages &
 		;;
 	esac
 	;;
@@ -144,6 +144,6 @@ case "$browser" in
 	eval "$browser_path" $pages
 	;;
     dillo)
-	nohup "$browser_path" $pages &
+	"$browser_path" $pages &
 	;;
 esac
-- 
1.5.4
Christian Couder· Feb 9, 2008, 05:53 UTC · re: Dmitry Potapov · lore

Re: [PATCH] remove "nohup" from git-help--browse

Le vendredi 8 février 2008, Dmitry Potapov a écrit :
> There is no good reason to run GUI browsers using "nohup". It does not
> solve any real problem but creates annoying "nohup.out" files in every
> directory where git help -w is run.

That's right, but if you just remove "nohup", then there may be some annoying browser output on the terminal. Perhaps we should also redirect stderr and stdout to /dev/null.

> This patch removes "nohup" from git-help--browse.sh

"git-help--browse.sh" has been renamed "git-web--browse.sh" in next so we need a similar patch for next.

Thanks, Christian.

Dmitry Potapov· Feb 9, 2008, 20:03 UTC · re: Christian Couder · lore

Re: [PATCH] remove "nohup" from git-help--browse

On Sat, Feb 09, 2008 at 06:53:43AM +0100, Christian Couder wrote:
Show 8 quoted lines
> Le vendredi 8 février 2008, Dmitry Potapov a écrit :
> > There is no good reason to run GUI browsers using "nohup". It does not
> > solve any real problem but creates annoying "nohup.out" files in every
> > directory where git help -w is run.
> 
> That's right, but if you just remove "nohup", then there may be some 
> annoying browser output on the terminal. Perhaps we should also redirect 
> stderr and stdout to /dev/null.

I don't mind this redirection, but I am not sure whether it is the right thing to do, because it may hide relevant error information, and if your browser tends to print irrelevant and annoying messages at start, then perhaps the script to start this browser should be corrected to suppress these output.

So, I want to hear what other people think. If there is no objection, I will add this redirection.

Show 5 quoted lines
> 
> > This patch removes "nohup" from git-help--browse.sh
> 
> "git-help--browse.sh" has been renamed "git-web--browse.sh" in next so we 
> need a similar patch for next.
Okay, I will base my patch on next.
Dmitry
Junio C Hamano· Feb 10, 2008, 02:02 UTC · re: Dmitry Potapov · lore

Re: [PATCH] remove "nohup" from git-help--browse

Dmitry Potapov <dpotapov@gmail.com> writes:
> So, I want to hear what other people think. If there is no objection,
> I will add this redirection.

I personally feel that we should not hide output from the backend browsers by redirection. Some may be chattier than others, but then we would know against which browser to file bug reports.

Just my two yen.
Johannes Schindelin· Feb 10, 2008, 02:06 UTC · re: Junio C Hamano · lore

Re: [PATCH] remove "nohup" from git-help--browse

Hi,
On Sat, 9 Feb 2008, Junio C Hamano wrote:
Show 11 quoted lines
> Dmitry Potapov <dpotapov@gmail.com> writes:
> 
> > So, I want to hear what other people think. If there is no objection,
> > I will add this redirection.
> 
> I personally feel that we should not hide output from the
> backend browsers by redirection.  Some may be chattier than
> others, but then we would know against which browser to file bug
> reports.
> 
> Just my two yen.

Yeah. If you do not like the chatty side, then there should be a way to configure a script which redirects stdout/stderr to be called in place of the browser binary.

Just my two (rapidly losing) pound.

Ciao, Dscho

← back to recent threads