Bug 218040 - app-backup/flexbackup-1.2.1-r7: workaround for cpio 2.9 is desired
|
Bug#:
218040
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: Linux
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: graaff@gentoo.org
|
Reported By: alexsaa@gmail.com
|
|
Component: Ebuilds
|
|
|
URL:
|
|
Summary: app-backup/flexbackup-1.2.1-r7: workaround for cpio 2.9 is desired
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2008-04-17 00:13 0000
|
cpio 2.9 has a problem of incorrect permissions set when extracting archive
created based on 'find -depth' output:
http://www.nabble.com/Re%3A-cpio-2.9%3A-sets-unexpected-%28wrong-%29-file-owner-UID-td15689526.html
As a result, flexbackup with 'cpio' archive type produces an archive that will
not be extracted correctly unless pruning (%prune) is used.
Steps to reproduce:
1. setup flexbackup to use cpio 2.9
2. prepare testcase:
su -
mkdir test; mkdir test/dir; touch test/dir/file
chown user test/dir; chmod 0500 test/dir
flexbackup -dir test
3. extract:
mkdir tmp; cd tmp
cat path/test.0.date.cpio |cpio -i --make-directories
4. check permission flags and owner uid for tmp/dir - they are 0755/root
instead of 0500/user.
Solutions/workarounds:
Pruning (%prune in conf file) makes flexbackup avoid using '-depth' option for
find and hence is a suitable user-only workaround.
Note: flexbackup code has a note about '-depth' option:
--- begin ---
# (not toally required anyway, only if you are archiving dirs you
# don't have permissions on and are running as non-root)
$cmd .= "-depth ";
--- end ---
I suggest never use '-depth' if type is 'cpio':
1. This would effectively avoid the serious problem under consideration.
2. Old versions of cpio (say, 2.6) are affected by the problem with non-root
users and no-permission dirs (noted in code quoted above). That problem was
rather subtle; also those old versions would hardly be found near to new
flexbackup revision.
3. IMHO: It seems cpio tries to support both 'find' and 'find -depth' and will
finally do so in future. So, future versions are not expected to prefer either
depth or non-depth mode.
The fix (works for me) would be as follows:
-- begin fix --
--- /usr/bin/flexbackup.old 2008-04-17 02:56:04.000000000 +0400
+++ /usr/bin/flexbackup 2008-04-17 01:50:24.000000000 +0400
@@ -4905,7 +4905,7 @@
# Can't use find -depth with -prune (see single unix spec etc)
# (not toally required anyway, only if you are archiving dirs you
# don't have permissions on and are running as non-root)
- $cmd .= "-depth ";
+ $cmd .= "-depth " unless $cfg::type eq 'cpio';
}
&line();
-- end fix --
I think, a comment with a kind of explanation of that 'unless' should also be
added to the code.
Under points 2 & 3 of motivation, I mean: The reason to use '-depth' as noted
in code is hardly important for cpio.
imho...
This sounds to me like a bug in cpio, so I'm wondering if this should not be
fixed in cpio instead of working around it in flexbackup. Looking at the
upstream bug tracker it looks like this never got reported as a bug for cpio.
I'm including base-system in the discussion to get their opinion on where to
fix this.
but if there's patches to be extracted from upstream, we can apply them to
cpio-2.9-r2
I have doubts if there may be any 'couple-of-lines' fix for the problem. There
are many cases depending on -depth option, current uid, etc. That does not seem
like a bug of coding.
Is it a good idea to ask at cpio-bugs for an advice which version should be
used?
asking is cheap, so go for it
cpio-2.9-r2 now in the tree with the patch ... thanks for tracking that down
The patch doesn't work in either my Core 2 or my Pentium 4 machine. When I use
cpio-2.9-r2, the command "find . -depth | cpio -padm /home/ivar/tempdump"
changes both the owner and the permissions of directories. If I repeat the
command without the "-depth," the problem goes away. Also, there is no problem
when I use cpio-2.8.
Ivar
Here is the emerge --info for my Core 2 machine:
Portage 2.1.4.4 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0,
2.6.25-gentoo-r4 x86_64)
=================================================================
System uname: 2.6.25-gentoo-r4 x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
Timestamp of tree: Mon, 09 Jun 2008 03:35:01 +0000
app-shells/bash: 3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python: 2.4.4-r13
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox: 1.2.18.1-r2
sys-devel/autoconf: 2.13, 2.61-r1
sys-devel/automake: 1.5, 1.6.3, 1.7.9-r1, 1.9.6-r2, 1.10.1
sys-devel/binutils: 2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool: 1.5.26
virtual/os-headers: 2.6.23-r3
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -fprefetch-loop-arrays -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config
/usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf
/etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c
/etc/udev/rules.d"
CXXFLAGS="-O2 -march=nocona -fprefetch-loop-arrays -pipe -ggdb"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer nostrip sandbox sfperms strict
unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distro.ibiblio.org/pub/linux/distributions/gentoo/
http://gentoo.osuosl.org/ http://gentoo.mirrors.tds.net/gentoo
http://gentoo.mirrors.pair.com/"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --stats --timeout=180 --exclude=/distfiles
--exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 acl acpi alsa amd64 berkdb cairo cdr cli cracklib crypt cups dbus
doc dri dvb dvd dvdnav dvdr dvdread eds emboss encode esd evo fam firefox
foomatic gdbm gif gmedia gpm gstreamer gtk hal iconv ipv6 isdnlog java
javascript jpeg kde kerberos ldap live mad midi mikmod mjpeg mmx mmxext mozilla
mp3 mpeg mudflap ncurses nls nptl nptlonly nsplugin ogg opengl openmp oss pam
pcre pdf perl png ppds pppd python qt qt3 qt3support qt4 quicktime readline
realmedia reflection scanner sdl session spell spl sqlite sqlite3 sse sse2 ssl
svg tcltk tcpd tiff tk truetype unicode usb v4l v4l2 vorbis wmp x264 xml xorg
xprint xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x
ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0
intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"
ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file
hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route
share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias
authn_anon authn_dbm authn_default authn_file authz_dbm authz_default
authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs
dav_lock deflate dir disk_cache env expires ext_filter file_cache filter
headers include info log_config logio mem_cache mime mime_magic negotiation
rewrite setenvif speling status unique_id userdir usertrack vhost_alias"
ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad
cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU"
VIDEO_CARDS="nvidia vesa"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL,
LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS,
PORTAGE_RSYNC_EXTRA_OPTS
Here is the emerge --info for my Pentium 4 machine:
Portage 2.1.4.4 (default-linux/x86/2007.0/desktop, gcc-4.2.0,
glibc-2.8_p20080602-r0, 2.6.24-g
entoo i686)
=================================================================
System uname: 2.6.24-gentoo i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Timestamp of tree: Mon, 09 Jun 2008 03:35:01 +0000
app-shells/bash: 3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python: 2.4.4-r13
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.12
sys-apps/sandbox: 1.2.18.1-r2
sys-devel/autoconf: 2.13, 2.61-r1
sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils: 2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool: 1.5.26
virtual/os-headers: 2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -fprefetch-loop-arrays -pipe -ggdb"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config
/usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf
/etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c
/etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium4 -fprefetch-loop-arrays -pipe -ggdb"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer nostrip sandbox sfperms strict
unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distro.ibiblio.org/pub/linux/distributions/gentoo/
http://gentoo.osuosl.org/ http://gentoo.mirrors.tds.net/gentoo
http://gentoo.mirrors.pair.com/"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --stats --timeout=180 --exclude=/distfiles
--exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 acl acpi alsa berkdb cairo cdr cli cracklib crypt cups dbus doc dri
dvb dvd dvdnav dvdr dvdread eds emboss encode esd evo fam firefox foomatic gdbm
gif gmedia gpm gstreamer gtk hal iconv ipv6 isdnlog java jpeg kde kerberos ldap
live mad midi mikmod mjpeg mmx mmxext mozilla mp3 mpeg mudflap ncurses nls nptl
nptlonly nsplugin ogg opengl openmp oss pam pcre pdf perl png ppds pppd python
qt qt3 qt3support qt4 quicktime readline real realmedia reflection scanner sdl
session spell spl sqlite sqlite3 sse sse2 ssl svg tcltk tcpd tiff truetype
unicode usb v4l v4l2 vorbis win32codecs wmp x264 x86 xml xorg xprint xv xvid
xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci
emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0
intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"
ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file
hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route
share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias
authn_anon authn_dbm authn_default authn_file authz_dbm authz_default
authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs
dav_lock deflate dir disk_cache env expires ext_filter file_cache filter
headers include info log_config logio mem_cache mime mime_magic negotiation
rewrite setenvif speling status unique_id userdir usertrack vhost_alias"
ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad
cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU"
VIDEO_CARDS="radeon fglrx vesa"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL,
LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS,
PORTAGE_RSYNC_EXTRA_OPTS