← Back to team overview

touch-packages team mailing list archive

[Bug 1472324] Re: Error when using -o with relative filename

 

Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: patch (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to patch in Ubuntu.
https://bugs.launchpad.net/bugs/1472324

Title:
  Error when using -o with relative filename

Status in patch package in Ubuntu:
  Confirmed

Bug description:
  I am getting the following error when specifying a relative filename for output. 
  patch -o ../test_file < ../empty.diff
  patch: **** Can't create file ../test_file : Invalid cross-device link

  The I have tried with real patch files and empty ones, the input file doesn't seem to matter the error only appears if I use '../' in the filename for -o.
  When I use just -o without '..', patch works fine.

  I don't know why the code is failing, but what ever it is trying to check for, the error message is misleading, since I am not crossing file systems. So either the error message needs to be fixed to describe the real issue, or relative filenames should be allowed here if they are still supposed to work. I see there are a number of  CVE patches, and that this bug was introduced when I updated to 
  2.7.1-5ubuntu0.3 0.

  According to gdb, the backtrace is that it is bailing out here:
  Breakpoint 1, __GI_exit (status=status@entry=2) at exit.c:104
  104     exit.c: No such file or directory.
  (gdb) bt
  #0  __GI_exit (status=status@entry=2) at exit.c:104
  #1  0x0000000000406d7d in fatal_exit (sig=sig@entry=0) at patch.c:1984
  #2  0x000000000040e083 in pfatal (format=format@entry=0x41934b "Can't create file %s") at util.c:962
  #3  0x000000000040e3ce in create_file (file=0x628020 "../test_file", open_flags=<optimized out>, mode=384, to_dir_known_to_exist=<optimized out>)
      at util.c:573
  #4  0x00000000004037ae in create_output_file (open_flags=<optimized out>, name=<optimized out>) at patch.c:1553
  #5  open_outfile (name=<optimized out>) at patch.c:1575
  #6  main (argc=6, argv=0x7fffffffd268) at patch.c:173

  
  $ lsb_release -rd
  Description:    Ubuntu 14.10
  Release:        14.10

  $ apt-cache policy patch
  patch:
    Installed: 2.7.1-5ubuntu0.3
    Candidate: 2.7.1-5ubuntu0.3
    Version table:
   *** 2.7.1-5ubuntu0.3 0
          500 http://ca.archive.ubuntu.com/ubuntu/ utopic-updates/main amd64 Packages
          500 http://security.ubuntu.com/ubuntu/ utopic-security/main amd64 Packages
          100 /var/lib/dpkg/status
       2.7.1-5 0
          500 http://ca.archive.ubuntu.com/ubuntu/ utopic/main amd64 Packages

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/patch/+bug/1472324/+subscriptions


References