bugGNU tar - Bugs: bug #61015, Race condition when extracting


bug #61015: Race condition when extracting

Submitter:  None
Submitted:  Fri 06 Aug 2021 06:30:28 AM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Ready For Test
Privacy:  Public Assigned to:  gray
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)

Tue 31 Jan 2023 09:16:36 AM UTC, comment #5: 

Sorry, I just saw this. I tested with today's HEAD (02402920f871a42099cb5af535815a27ccd3ed0f) and I was not able to reproduce the bug. The same test case was able to reproduce using an old version of tar.

So I believe this is fixed !

Thanks you very much for this.

Sat 22 Oct 2022 06:53:57 PM UTC, comment #4: 

I believe it is fixed.  Please, test.

Sergey Poznyakoff <gray>
Project Administrator
Thu 22 Sep 2022 02:17:05 PM UTC, comment #3: 


Is there anything I can do to speed up the resolution of this bug ?

Thank you !

Mon 09 Aug 2021 07:12:19 AM UTC, comment #2: 

Thank you !

Git blame already pointed me to the commit you reference, but I wasn't sure why the extra check had been introduced as well.

Let me know if I can help in any way.

Fri 06 Aug 2021 09:19:01 AM UTC, comment #1: 


Thanks for reporting.  The rationale for this change is explained here: http://git.savannah.gnu.org/cgit/tar.git/commit/?id=9447e799ab5faa6e8be43de4000e1061e0879242

However, I agree that the extra check for *interdir_made in line 832 is not strictly necessary and should be removed.

Sergey Poznyakoff <gray>
Project Administrator
Fri 06 Aug 2021 06:30:28 AM UTC, original submission:  


I'm not sure it is an appropriate usage, but I use GNU tar to extract several tar archives containing different files in the same directory tree.

I sometime encounter an error when two different tar processes launched in parallel try to create the intermediate directories at the same time.

What happens:
 - process 1 tries to create file dir1/file1, receives ENOENT because dir1 doesn't exist
 - process 2 tries to create file dir1/file2, with the same result
 - process 1 uses make_directories to create dir1, the call succeed, it returns a 0 status and set the interdir_made flag
 - process 2 also uses make_directories to create dir1, everything is fine and it returns a 0 but doesn't set the interdir_made flag as process 1 already created the hierarchy
 - process 1 can extract the file dir1/file1
 - process 2 ends up in RECOVERY_NO state, and exits with a fatal error.

Why does it check the interdir_made flag ? If the make_directories function returns a status of zero, that mean the directory exists after all and maybe we should try to recover from that ?



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

Attach Files:

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 gray (Posted a comment)

    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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-11 gray Open/ClosedOpen Closed
    2022-10-22 gray StatusIn Progress Ready For Test
    2021-08-06 gray StatusNone In Progress
        Assigned toNone gray

    Back to the top

    Powered by Savane 3.11