Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 451082 - distutils-r1: finding a better image merging method
Summary: distutils-r1: finding a better image merging method
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 447370 449760
  Show dependency tree
 
Reported: 2013-01-09 19:13 UTC by Michał Górny
Modified: 2013-06-13 05:19 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Test case (cp-testcase.bash,513 bytes, text/plain)
2013-01-09 19:13 UTC, Michał Górny
Details
Version compatible with FreeBSD (cp-testcase.bash,682 bytes, text/plain)
2013-01-09 20:04 UTC, Michał Górny
Details
Suggested (temporary) solution (0001-Use-locking-to-avoid-race-conditions-and-tar-on-Free.patch,1.29 KB, patch)
2013-01-10 21:17 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-01-09 19:13:23 UTC
Created attachment 334986 [details]
Test case

The current 'cp -aln' method suffers race conditions on GNU and broken handling of dead symlinks on FreeBSD.

Let's find a new, better method of moving files from sub-image to real-image.

The new method should:

1) work on GNU and BSD flawlessly,

2) be able to work in parallel (if possible),

3) be fast and efficient, and avoid duplicating files (hardlink) if possible.

I've prepared a quick test case for it which I'm attaching here.


My results so far (with tmpfs):

  cp -aln -- 1.9s, a lot of failures

  cp -an -- 2.3s, a lot of failures

  cp -a -- 4.1s+, a lot of failures

  tar -c | tar -x -- 4s, few failures
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-01-09 20:04:44 UTC
Created attachment 334988 [details]
Version compatible with FreeBSD

BSD is so... dusted...

A few quick tests on a semi-virtual shell give:

  tar -- 22s, a lot of errors
  cp -aln -- unlimited number of errors
  cp -an -- 5s, few errors
  cp -a -- 11s, few errors

So simply saying, none of the methods work.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-01-09 20:07:02 UTC
Out of curiosity:

  rsync: no errors, 12s on Linux, 'command not found' on my FBSD shell :P
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-01-09 22:38:31 UTC
So far, the only solution which doesn't require external deps and works both on Linux and FreeBSD without any errors is 'tar -cf - . | tar -xf -' with locking.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-01-10 21:17:21 UTC
Created attachment 335106 [details, diff]
Suggested (temporary) solution

This is how I'd make it for now, until we find a better way.

Locking should handle race conditions, and 'tar' has proper behavior with symlinks on BSD.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-06-13 05:19:51 UTC
Seems like there's no nothing happening on the bug anymore.