tar: -m option

Yauheni Kaliuta yauheni.kaliuta at gmail.com
Wed Jun 6 15:59:56 UTC 2007


Hi!

dpkg (normal dpkg) uses -m switch for tar, it fails with busybox's
tar. I added a dummy switch, for it. What do you think about it?

Thank you!

--- busybox/archival/Config.in.orig     2007-02-08 19:15:49.000000000 +0200
+++ busybox/archival/Config.in  2007-02-08 19:39:32.000000000 +0200
@@ -213,6 +213,13 @@
       help
               Enable use of long options, increases size by about 400 Bytes

+config FEATURE_TAR_TOUCH
+       bool "Enable ignoring touch option"
+       default n
+       depends on TAR
+       help
+         Allows compatibility with -m / --touch command line option.
+
 config UNCOMPRESS
       bool "uncompress"
       default n
diff --git a/archival/tar.c b/archival/tar.c
index ca59643..0e6235a 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -691,6 +691,7 @@ enum {
       USE_FEATURE_TAR_COMPRESS(OPTBIT_COMPRESS    ,)
       OPTBIT_NOPRESERVE_OWN,
       OPTBIT_NOPRESERVE_PERM,
+       USE_FEATURE_TAR_TOUCH(   OPTBIT_TOUCH       ,)
       OPT_TEST         = 1 << 0, // t
       OPT_EXTRACT      = 1 << 1, // x
       OPT_BASEDIR      = 1 << 2, // C
@@ -709,6 +710,7 @@ enum {
       OPT_COMPRESS     = USE_FEATURE_TAR_COMPRESS((1<<OPTBIT_COMPRESS
)) + 0, // Z
       OPT_NOPRESERVE_OWN  = 1 << OPTBIT_NOPRESERVE_OWN , // no-same-owner
       OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, //
no-same-permissions
+       OPT_TOUCH        = USE_FEATURE_TAR_TOUCH(   (1<<OPTBIT_TOUCH
)) + 0, // m
 };
 #if ENABLE_FEATURE_TAR_LONG_OPTIONS
 static const struct option tar_long_options[] = {
@@ -748,6 +750,10 @@ static const struct option tar_long_options[] = {
 # if ENABLE_FEATURE_TAR_FROM
       { "exclude",            1,  NULL,   0xff },
 # endif
+# if ENABLE_FEATURE_TAR_TOUCH
+       { "touch",              0,  NULL,   'm' },
+# endif
+
       { 0,                    0, 0, 0 }
 };
 #endif
@@ -788,6 +794,7 @@ int tar_main(int argc, char **argv)
               USE_FEATURE_TAR_FROM(    "T:X:")
               USE_FEATURE_TAR_GZIP(    "z"   )
               USE_FEATURE_TAR_COMPRESS("Z"   )
+               USE_FEATURE_TAR_TOUCH(   "m"   )
               ,
               &base_dir, // -C dir
               &tar_filename, // -f filename
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/busybox/attachments/20070606/ee9a908b/attachment-0002.htm 


More information about the busybox mailing list