bugQuilt - Bugs: bug #63369, Quilt fails with a "Can't...

 
 

bug #63369: Quilt fails with a "Can't backup" error on macOS 13 due to a bug in macOS patch

Submitter:  Robert Mathews <tigertech>
Submitted:  Mon 14 Nov 2022 11:04:40 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  khali
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 20 Jan 2023 12:08:18 PM UTC, comment #2: 

Thanks for posting this information so that users affected can find it. I'm closing this bug though as this isn't a quilt bug.

Jean Delvare <khali>
Group administrator
Tue 15 Nov 2022 05:35:42 PM UTC, comment #1: 

If anyone is looking for a workaround for this, you can install GNU patch on a Mac using homebrew:


brew install gpatch


Be sure to close your existing console window and open a new one after installing it to test this (otherwise it may still use the original Apple "patch").

Robert Mathews <tigertech>
Mon 14 Nov 2022 11:04:40 PM UTC, original submission:  

This may or may not be something that can be worked around in quilt, but in any case, I'm reporting it so that people aren't mystified when it happens to them.

The symptom is that when using "quilt push", it fails with an error like:


Can't backup '/var/folders/nb/2gx6t6wx63b30222g0r47w6c0000gn/T/patchoSGifYqRkQK', output is in '/var/folders/nb/2gx6t6wx63b30222g0r47w6c0000gn/T/patchoSGifYqRkQK': No such file or directory
Patch patches/patchname.diff appears to be empty; applied


See https://github.com/coder/code-server/issues/5770 for an example of this in the real world.

The bug appears to be in the macOS 13 patch program -- it fails with this error if both "--backup" and "--prefix" are used and the target to be patched has multiple levels (which often happens with quilt). Here's a reproducible demonstration of the problem. This works, as you would expect:


mkdir patchtemp
echo 123456 > patchtemp/temp1
echo 1234x6 > patchtemp/temp2
cd patchtemp
diff -u temp1 temp2 > temp.patch
mkdir tempdir
patch --backup --prefix=tempdir/ -i temp.patch


However, if you introduce different levels into the patch file, like this:


mkdir patchtemp
echo 123456 > patchtemp/temp1
echo 1234x6 > patchtemp/temp2
diff -u patchtemp/temp1 patchtemp/temp2 > patchtemp/temp.patch
mkdir patchtemp/tempdir
patch --backup --prefix=patchtemp/tempdir/ -i patchtemp/temp.patch


... then you get the error:


Can't backup '/var/folders/nb/2gx6t6wx63b30222g0r47w6c0000gn/T/patchoSGifYqRkQK', output is in '/var/folders/nb/2gx6t6wx63b30222g0r47w6c0000gn/T/patchoSGifYqRkQK': No such file or directory


This presumably happens because in the first example, it tries to create the backup file at "patchtemp/tempdir/temp1-nomarkup", and that works fine since "patchtemp/tempdir" already exists. But in the second case, it tries to create it at "patchtemp/tempdir/patchtemp/temp1", which requires that patch make a temporary directory at "patchtemp/tempdir/patchtemp" first. But it's instead creating it at "/var/folders/nb/2gx6t6wx63b30222g0r47w6c0000gn/T/patchoSGifYqRkQK".

This problem is new with macOS 13, so I reported it earlier today to Apple using the Feedback Assistant.

Robert Mathews <tigertech>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by khali (Posted a comment)
  • -email is unavailable- added by tigertech (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-20 khali StatusNone Works For Me
        Assigned toNone khali
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code