Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F96234384
D42273.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42273.diff
View Options
diff --git a/usr.bin/xinstall/tests/install_test.sh b/usr.bin/xinstall/tests/install_test.sh
--- a/usr.bin/xinstall/tests/install_test.sh
+++ b/usr.bin/xinstall/tests/install_test.sh
@@ -481,6 +481,21 @@
atf_check_equal "$u:$g:10$cM" "$(stat -f"%u:%g:%p" testc)"
}
+atf_test_case set_optional_exec
+set_optional_exec_head() {
+ atf_set "require.user" "unprivileged"
+}
+set_optional_exec_body()
+{
+ echo "abc" > testfile.src
+
+ atf_check install -d -m ug+rX testdir
+ atf_check test -x testdir
+
+ atf_check install -m ug+rX testfile.src testfile
+ atf_check test ! -x testfile
+}
+
atf_init_test_cases() {
atf_add_test_case copy_to_nonexistent
atf_add_test_case copy_to_nonexistent_safe
@@ -523,4 +538,5 @@
atf_add_test_case mkdir_simple
atf_add_test_case set_owner_group_mode
atf_add_test_case set_owner_group_mode_unpriv
+ atf_add_test_case set_optional_exec
}
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -189,6 +189,7 @@
fset = 0;
iflags = 0;
+ set = NULL;
group = owner = NULL;
while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) !=
-1)
@@ -255,11 +256,10 @@
break;
case 'm':
haveopt_m = 1;
+ free(set);
if (!(set = setmode(optarg)))
errx(EX_USAGE, "invalid file mode: %s",
optarg);
- mode = getmode(set, 0);
- free(set);
break;
case 'N':
if (!setup_getid(optarg))
@@ -301,6 +301,14 @@
usage();
}
+ /*
+ * Default permissions based on whether we're a directory or not, since
+ * an +X may mean that we need to set the execute bit.
+ */
+ if (set != NULL)
+ mode = getmode(set, dodir ? S_IFDIR : 0) & ~S_IFDIR;
+ free(set);
+
if (getenv("DONTSTRIP") != NULL) {
warnx("DONTSTRIP set - will not strip installed binaries");
dostrip = 0;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 25, 4:15 AM (16 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12729552
Default Alt Text
D42273.diff (1 KB)
Attached To
Mode
D42273: install: handle -m +X more accurately
Attached
Detach File
Event Timeline
Log In to Comment