* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2015-09-03 23:08 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2015-09-03 23:08 UTC (permalink / raw
To: gentoo-commits
commit: 0ea4fa5a3008aa6d90b74a3bf2d1aaff4e2f0598
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Thu May 28 14:31:00 2015 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Sep 3 23:11:07 2015 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=0ea4fa5a
misc/install-xattr: ignore all whitespace in PORTAGE_XATTR_EXCLUDE
if the PORTAGE_XATTR_EXCLUDE variable contains whitespace other
than just ' ', the matching fails to exclude what comes after it.
This replaces all whitespace instead of only just space.
Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org>
misc/install-xattr/install-xattr.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index b650c67..0b5eb25 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -261,8 +261,12 @@ main(int argc, char* argv[])
* strings. Also, no need to free(exclude) before we exit().
*/
char *p = exclude;
- while ((p = strchr(p, ' ')))
- *p++ = '\0';
+ char *pend = p + len_exclude;
+ while (p != pend) {
+ if (isspace(*p))
+ *p = '\0';
+ p++;
+ }
opterr = 0; /* we skip many legitimate flags, so silence any warning */
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2015-09-03 23:08 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2015-09-03 23:08 UTC (permalink / raw
To: gentoo-commits
commit: 8372fc65f82d689f353b654a70f00c7b25a7846c
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 8 13:07:22 2015 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Sep 3 23:11:32 2015 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=8372fc65
misc/install-xattr: update ChangeLog
misc/install-xattr/ChangeLog | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/misc/install-xattr/ChangeLog b/misc/install-xattr/ChangeLog
index b8c947d..1d25ca5 100644
--- a/misc/install-xattr/ChangeLog
+++ b/misc/install-xattr/ChangeLog
@@ -1,6 +1,12 @@
Okay we'll document changes here. This is a small project, so we don't
have to be very formal.
+2015-06-08
+
+ * Release 0.5
+ * Correct whitespace in PORTAGE_XATTR_EXCLUDE.
+ https://bugs.gentoo.org/show_bug.cgi?id=550654.
+
2014-10-12
* Release 0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2019-03-30 10:13 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2019-03-30 10:13 UTC (permalink / raw
To: gentoo-commits
commit: 54ebf6793e3f869ad3883e04bfea1173897cb01a
Author: Nick Bowler <nbowler <AT> draconx <DOT> ca>
AuthorDate: Sat Mar 30 10:10:31 2019 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Mar 30 10:12:53 2019 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=54ebf679
install-xattr: report any errors by "stat"
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
misc/install-xattr/checkcopyattrs.sh | 3 +++
misc/install-xattr/install-xattr.c | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/misc/install-xattr/checkcopyattrs.sh b/misc/install-xattr/checkcopyattrs.sh
index 9196795..a9149d7 100755
--- a/misc/install-xattr/checkcopyattrs.sh
+++ b/misc/install-xattr/checkcopyattrs.sh
@@ -49,6 +49,9 @@ setfattr -n user.pax.flags -v "r" c
[ "$(getfattr --only-values -n user.bas f/a)" == "x" ]
[ "$(getfattr --only-values -n user.pax.flags f/a)" == "mr" ]
+# Check that we can copy large files
+truncate -s2G a
+./install-xattr a x
# The following are just tests to make sure the raw install
# options don't get lost in our optargs parsing.
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index 0b5eb25..3e20b63 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -365,8 +365,10 @@ main(int argc, char* argv[])
if (!opts_target_directory) {
target = argv[last];
- if (stat(target, &s) != 0)
+ if (stat(target, &s) != 0) {
+ err(1, "failed to stat %s", target);
return EXIT_FAILURE;
+ }
target_is_directory = S_ISDIR(s.st_mode);
} else {
/* target was set above with the -t option */
@@ -381,8 +383,10 @@ main(int argc, char* argv[])
last++;
for (i = first; i < last; i++) {
- if (stat(argv[i], &s) != 0)
+ if (stat(argv[i], &s) != 0) {
+ err(1, "failed to stat %s", argv[i]);
return EXIT_FAILURE;
+ }
/* We reproduce install's behavior and skip
* all extra directories on the command line
* that are not the final target directory.
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2019-04-14 19:02 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2019-04-14 19:02 UTC (permalink / raw
To: gentoo-commits
commit: 530a6008938d6657e6b64f389c902f365c8f19be
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 14 18:39:44 2019 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Apr 14 19:01:51 2019 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=530a6008
install-xattr: address compiler warnings, bug #682110
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
misc/install-xattr/install-xattr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index 3e20b63..5c8a978 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -239,7 +239,7 @@ main(int argc, char* argv[])
int target_is_directory = 0; /* is the target a directory? */
int first, last; /* argv indices of the first file/directory and last */
- char *target; /* the target file or directory */
+ char *target = NULL; /* the target file or directory */
char *path; /* path to the target file */
char *mypath = realpath("/proc/self/exe", NULL); /* path to argv[0] */
@@ -331,7 +331,8 @@ main(int argc, char* argv[])
char *portage_helper_path = getenv("__PORTAGE_HELPER_PATH");
char *portage_helper_canpath = NULL;
if (portage_helper_path)
- chdir(oldpwd);
+ if (chdir(oldpwd) != 0)
+ err(1, "failed to chdir %s", oldpwd);
switch (fork()) {
case -1:
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2019-11-09 18:19 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2019-11-09 18:19 UTC (permalink / raw
To: gentoo-commits
commit: bb01196aa12be86e7c37a420de0cd7ada82bf9a9
Author: Raimonds Cicans <ray <AT> apollo <DOT> lv>
AuthorDate: Sat Nov 9 18:16:11 2019 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Nov 9 18:16:11 2019 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=bb01196a
install-xattr: correct -Z flag, bug #699550
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
misc/install-xattr/install-xattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index 5c8a978..ab3d041 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -278,14 +278,14 @@ main(int argc, char* argv[])
{ "mode", required_argument, 0, 'm'},
{ "owner", required_argument, 0, 'o'},
{ "suffix", required_argument, 0, 'S'},
- { "context", optional_argument, 0, 'Z'},
+ { "context", optional_argument, 0, 0 },
{ "backup", optional_argument, 0, 'b'},
{ "help", no_argument, 0, 0 },
{ 0, 0, 0, 0 }
};
int option_index;
- int c = getopt_long(argc, argv, "dt:g:m:o:S:Z:", long_options, &option_index);
+ int c = getopt_long(argc, argv, "dt:g:m:o:S:Z", long_options, &option_index);
if (c == -1)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2019-11-09 18:19 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2019-11-09 18:19 UTC (permalink / raw
To: gentoo-commits
commit: 2940cf3de445e0614c6ab4305a459c1d4d7e8ba2
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 9 18:19:31 2019 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Nov 9 18:19:31 2019 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=2940cf3d
install-xattr: correct -b flag
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
misc/install-xattr/install-xattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index ab3d041..cc52b2c 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -279,13 +279,13 @@ main(int argc, char* argv[])
{ "owner", required_argument, 0, 'o'},
{ "suffix", required_argument, 0, 'S'},
{ "context", optional_argument, 0, 0 },
- { "backup", optional_argument, 0, 'b'},
+ { "backup", optional_argument, 0, 0 },
{ "help", no_argument, 0, 0 },
{ 0, 0, 0, 0 }
};
int option_index;
- int c = getopt_long(argc, argv, "dt:g:m:o:S:Z", long_options, &option_index);
+ int c = getopt_long(argc, argv, "dt:g:m:o:S:Zb", long_options, &option_index);
if (c == -1)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2019-11-10 0:58 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2019-11-10 0:58 UTC (permalink / raw
To: gentoo-commits
commit: fdaadadb1b53a7a3aba12a653d1e893a17400aaa
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 00:52:01 2019 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 00:56:53 2019 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=fdaadadb
install-xattr: -Z and -b flags do not accept arguments
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
misc/install-xattr/install-xattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index 5c8a978..1c39e69 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -285,7 +285,7 @@ main(int argc, char* argv[])
};
int option_index;
- int c = getopt_long(argc, argv, "dt:g:m:o:S:Z:", long_options, &option_index);
+ int c = getopt_long(argc, argv, "dt:g:m:o:S:Zb", long_options, &option_index);
if (c == -1)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/
@ 2019-11-10 0:59 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2019-11-10 0:59 UTC (permalink / raw
To: gentoo-commits
commit: 5f4c2424f1b8c4741631c9eae2d5cd6bfbe8c7b9
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 00:52:31 2019 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 00:58:45 2019 +0000
URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=5f4c2424
install-xattr: fix mangling of parameter order by getopt_long()
See: https://bugs.gentoo.org/699550
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
misc/install-xattr/install-xattr.c | 53 +++++++++++++++++++++++---------------
1 file changed, 32 insertions(+), 21 deletions(-)
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index 1c39e69..66530f9 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -234,6 +234,8 @@ main(int argc, char* argv[])
int i;
int status; /* exit status of child "install" process */
+ char** argv_copy; /* copy argv to avoid mangling by getopt_long() */
+
int opts_directory = 0; /* if -d was given, then all arguments are directories */
int opts_target_directory = 0; /* if -t was given, then we're installing to a target directory */
int target_is_directory = 0; /* is the target a directory? */
@@ -270,23 +272,32 @@ main(int argc, char* argv[])
opterr = 0; /* we skip many legitimate flags, so silence any warning */
- while (1) {
- static struct option long_options[] = {
- { "directory", no_argument, 0, 'd'},
- { "target-directory", required_argument, 0, 't'},
- { "group", required_argument, 0, 'g'},
- { "mode", required_argument, 0, 'm'},
- { "owner", required_argument, 0, 'o'},
- { "suffix", required_argument, 0, 'S'},
- { "context", optional_argument, 0, 'Z'},
- { "backup", optional_argument, 0, 'b'},
- { "help", no_argument, 0, 0 },
- { 0, 0, 0, 0 }
- };
+ static struct option long_options[] = {
+ { "directory", no_argument, 0, 'd'},
+ { "target-directory", required_argument, 0, 't'},
+ { "group", required_argument, 0, 'g'},
+ { "mode", required_argument, 0, 'm'},
+ { "owner", required_argument, 0, 'o'},
+ { "suffix", required_argument, 0, 'S'},
+ { "context", optional_argument, 0, 'Z'},
+ { "backup", optional_argument, 0, 'b'},
+ { "help", no_argument, 0, 0 },
+ { 0, 0, 0, 0 }
+ };
+
+ /* We copy argv[] because getopts_long() mangles the order of the arguments.
+ * We pass the original argv[] to install in the fork() while we use
+ * argv_copy[] for the copying of the xattrs since optind assumes a reorder
+ * parameter list.
+ */
+ argv_copy = (char **)malloc(argc*sizeof(char *));
- int option_index;
- int c = getopt_long(argc, argv, "dt:g:m:o:S:Zb", long_options, &option_index);
+ for (i = 0; i < argc; i++)
+ argv_copy[i] = strdup(argv[i]);
+ while (1) {
+ int option_index;
+ int c = getopt_long(argc, argv_copy, "dt:g:m:o:S:Zb", long_options, &option_index);
if (c == -1)
break;
@@ -365,7 +376,7 @@ main(int argc, char* argv[])
goto done;
if (!opts_target_directory) {
- target = argv[last];
+ target = argv_copy[last];
if (stat(target, &s) != 0) {
err(1, "failed to stat %s", target);
return EXIT_FAILURE;
@@ -384,8 +395,8 @@ main(int argc, char* argv[])
last++;
for (i = first; i < last; i++) {
- if (stat(argv[i], &s) != 0) {
- err(1, "failed to stat %s", argv[i]);
+ if (stat(argv_copy[i], &s) != 0) {
+ err(1, "failed to stat %s", argv_copy[i]);
return EXIT_FAILURE;
}
/* We reproduce install's behavior and skip
@@ -395,12 +406,12 @@ main(int argc, char* argv[])
if (S_ISDIR(s.st_mode))
continue;
- path = path_join(target, basename(argv[i]));
- copyxattr(argv[i], path);
+ path = path_join(target, basename(argv_copy[i]));
+ copyxattr(argv_copy[i], path);
free(path);
}
} else
- copyxattr(argv[first], target);
+ copyxattr(argv_copy[first], target);
done:
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-11-10 11:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-03 23:08 [gentoo-commits] proj/elfix:elfix-0.9.x commit in: misc/install-xattr/ Anthony G. Basile
-- strict thread matches above, loose matches on Subject: below --
2015-09-03 23:08 Anthony G. Basile
2019-03-30 10:13 Anthony G. Basile
2019-04-14 19:02 Anthony G. Basile
2019-11-09 18:19 Anthony G. Basile
2019-11-09 18:19 Anthony G. Basile
2019-11-10 0:58 Anthony G. Basile
2019-11-10 0:59 Anthony G. Basile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox