seek(0) on /dev/stdin crashes

Bug #1652953 reported by Dan Faerch
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

    $ duplicity --version
    duplicity 0.7.06

    $ python --version
    Python 3.5.2 :: Anaconda 4.1.1 (64-bit)

I receive this crash on ubuntu 16.04 (after dist-upgrading from 14.04):

Reading globbing filelist /dev/stdin
Using temporary directory /tmp/duplicity-_9R_Ux-tempdir
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1532, in <module>
  File "/usr/bin/duplicity", line 1526, in with_tempdir
  File "/usr/bin/duplicity", line 1364, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python2.7/dist-packages/duplicity/", line 1130, in ProcessCommandLine
  File "/usr/lib/python2.7/dist-packages/duplicity/", line 968, in set_selection
    sel.ParseArgs(select_opts, select_files)
  File "/usr/lib/python2.7/dist-packages/duplicity/", line 263, in ParseArgs
    for sf in self.filelist_globbing_get_sfs(filelists[filelists_index], 0, arg):
  File "/usr/lib/python2.7/dist-packages/duplicity/", line 370, in filelist_globbing_get_sfs
IOError: [Errno 29] Illegal seek

I think it is because i do something like:

    $ find /home/ -size +800M | duplicity --exclude-filelist=/dev/stdin

But.. On linux, you cannot seek on stdin, if stdin arrives from a pipe. You could, if it had been a file-redirection, like so:

    $ program_that_seeks_stdin < file.txt

but not:

    $ cat file.txt | program_that_seeks_stdin

In my case, i solved it by wrapping the seek in a "try: except: pass" block, but that might not be a solution if the file-descriptor has already been read and the position actually needs to be reset.

Revision history for this message
Dan Faerch (u-launchpad-dan-hacker-dk) wrote :

I ran into to this again, after upgrading to the newest version, to get a fix for another bug.

This time i remembered to take a diff :). Patch-file attached.

Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.8.19
status: New → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers