Package: debian-goodies
Version: 0.40
Tags: patch

Popbugs deletes the temporary output file too quickly if the browser does
not block, resulting in a "File not found" error.

This is because calls to os.system return immediately for these browsers,
resulting in the termination of the popbugs script. This in-turn causes
the temporary file created by tempfile.NamedTemporaryFile to be garbage-
collected, which--by its own contract--unlinks the file.

Epiphany (and other browsers) only block if they are the only instance:

 # killall epiphany-browser
 # epiphany /tmp/foo.html
  [Blocks]

 # killall epiphany-browser
 # epiphany /tmp/foo.html &
  [Blocks, but daemonised]
 # epiphany /tmp/bar.html
 #
  [Second instance does not block]
 

The patch is simple; simply use a more long-lived temporary file:

  --- ./popbugs.orig   2007-07-09 21:37:50.000000000 +0100
  +++ ./popbugs        2008-03-19 22:45:19.000000000 +0000
  @@ -67,8 +67,8 @@
           sys.exit(1)
       
   if outputfile == None:
  -    output = tempfile.NamedTemporaryFile(suffix='.html')
  -    outputfile = output.name
  +    fd, outputfile = tempfile.mkstemp(suffix='.html')
  +    output = os.fdopen(fd, 'w')
       view = 1
   elif outputfile == '-':
       output = sys.stdout


Regards,

-- 
Chris Lamb, UK                                       [EMAIL PROTECTED]
                                                            GPG: 0x634F9A20

Attachment: signature.asc
Description: PGP signature

Reply via email to