Opened 5 years ago
Last modified 5 years ago
#59283 new enhancement
xinstall: Prevent the creation of pathless directories that looks like octal permission numbers, like 755
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | 2.6.1 |
Keywords: | Cc: | ||
Port: |
Description
It is an easy enough mistake for a portfile author to write something like:
xinstall -d 755 /some/directory
In addition to creating the directory /some/directory as the developer intended, it also creates the directory /opt/local/var/macports/755, which the developer did not intend and which is pointless.
What they meant to write was:
xinstall -d -m 755 /some/directory
I've corrected these errors in several ports over the years, such as in f1cf37b6fdbdab8f549514f9abd39a3937e802f0/macports-ports.
To catch these errors before they get committed, it would be nice if xinstall
would return an error if the directory it is being asked to create has no path and is named like a permission number: optional leading 0, then three digits 0-7.
Or possibly xinstall
should just error out anytime a path is not specified, since the cd
command was removed a looong time ago so installation should always be by absolute path now.
Rejecting certain directory names would be terrible. Rejecting all relative paths would probably be OK. Unless -W is used, of course.