geany creates and leaves around copies of geany_run_script.sh

Bug #348174 reported by Martin Olsson on 2009-03-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Geany
Unknown
Unknown
geany (Ubuntu)
Low
Unassigned

Bug Description

repro steps:
1. geany a.py
2. press F5 to run it
3. it shows a terminal with some error and asks user to press ENTER to close the terminal
4. instead press CTRL-C

Actual:
geany how aborts geany_run_script.sh execution so that the last line nevers gets run (the last line is "rm $0" because the user is never supposed to even know that geany_run_script.sh is being created, it's an implementation detail).

Expected:
geany should never leave copies of geany_run_script.sh around

Note #1: I use geany for tons of stuff.... I did a quick search in my home dir and found tens of copies littered all over, in all kinds of dirs. they are just junk, I don't want them there.

Good news is that the fix is easy, the "rm $0" command just needs to execute before the terminal window waits for the ENTER key stroke.

The following patch does exactly that:

diff -r -u geany_apt_clean/geany-0.16/src/build.c geany_apt/geany-0.16/src/build.c
--- geany_apt_clean/geany-0.16/src/build.c 2009-02-10 22:10:50.000000000 +0100
+++ geany_apt/geany-0.16/src/build.c 2009-03-24 22:41:19.000000000 +0100
@@ -944,7 +944,7 @@
 #else
  str = g_strdup_printf(
   "#!/bin/sh\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
- \n\n%s\nrm $0\n", cmd, (autoclose) ? "" :
+ \nrm $0\n%s\n", cmd, (autoclose) ? "" :
   "\necho \"Press return to continue\"\n#to be more compatible with shells like dash\ndummy_var=\"\"\nread dummy_var");
 #endif

Related branches

On Tue, 2009-03-24 at 21:50 +0000, martin wrote:
> Public bug reported:
>
> repro steps:
> 1. geany a.py
> 2. press F5 to run it
> 3. it shows a terminal with some error and asks user to press ENTER to close the terminal
> 4. instead press CTRL-C
>
> Actual:
> geany how aborts geany_run_script.sh execution so that the last line nevers gets run (the last line is "rm $0" because the user is never supposed to even know that geany_run_script.sh is being created, it's an implementation detail).
>
> Expected:
> geany should never leave copies of geany_run_script.sh around
>
>
> Note #1: I use geany for tons of stuff.... I did a quick search in my home dir and found tens of copies littered all over, in all kinds of dirs. they are just junk, I don't want them there.
>
> Good news is that the fix is easy, the "rm $0" command just needs to
> execute before the terminal window waits for the ENTER key stroke.
>
> The following patch does exactly that:
>
> diff -r -u geany_apt_clean/geany-0.16/src/build.c geany_apt/geany-0.16/src/build.c
> --- geany_apt_clean/geany-0.16/src/build.c 2009-02-10 22:10:50.000000000 +0100
> +++ geany_apt/geany-0.16/src/build.c 2009-03-24 22:41:19.000000000 +0100
> @@ -944,7 +944,7 @@
> #else
> str = g_strdup_printf(
> "#!/bin/sh\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
> - \n\n%s\nrm $0\n", cmd, (autoclose) ? "" :
> + \nrm $0\n%s\n", cmd, (autoclose) ? "" :
> "\necho \"Press return to continue\"\n#to be more compatible with shells like dash\ndummy_var=\"\"\nread dummy_var");
> #endif
>
> ** Affects: geany
> Importance: Unknown
> Status: Unknown
>
> ** Affects: geany (Ubuntu)
> Importance: Undecided
> Status: New
>
> ** Bug watch added: SourceForge.net Tracker #2710482
> http://sourceforge.net/support/tracker.php?aid=2710482
>
> ** Also affects: geany via
> http://sourceforge.net/support/tracker.php?aid=2710482
> Importance: Unknown
> Status: Unknown
>
Your fix will still fail if the program goes into an infinite loop and
you terminate it. How about putting rm $0 at the beginning of the
script? Somewhere just after #!/bin/sh\n, but before %s.
--
Chow Loong Jin

Thank you for your bug report.

Marking this as triaged as it's also reported upstream. No need to file a bug report on Launchpad if you report bugs upstream.

Thanks,

Changed in geany:
importance: Undecided → Low
status: New → Triaged
Martin Olsson (mnemo) wrote :

I would like to get this fixed in jaunty as well (we're past FF so a new geany version is not very likely afaik).

Jérôme, maybe you can review and sponsor this upload? Thanks.

Thanks for the patch but I'm not going to add patches that have not yet been accepted upstream. Once this is fixed in upstream SVN, I will consider backporting the patch.

Martin Olsson (mnemo) wrote :

Good news, the patch was commit upstream yesterday.

commit 066f9079ca7cd7ebd6859d10c45f36af55bc5f6f
Author: Enrico Tröger <email address hidden>
Date: Wed Mar 25 18:52:17 2009 +0000

I'm attaching an updated debdiff that uses the diff from upstream and also mentions the upstream commit sha in changelog.

Martin Olsson (mnemo) on 2009-03-26
Changed in geany:
status: Triaged → Confirmed
Gauvain Pocentek (gpocentek) wrote :

The patch is uploaded, it waits for an archive admin approval. Thanks.

Martin Olsson (mnemo) wrote :

Thank you Gauvain! :-)

Changed in geany:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.