#49501 closed defect (fixed)
Spaces and Backslashes in Group Names
Reported by: | citibob@… | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Low | Milestone: | MacPorts 2.9.0 |
Component: | base | Version: | 2.3.4 |
Keywords: | haspatch | Cc: | ryandesign (Ryan Carsten Schmidt), chucko58 (Chuck Fry), neverpanic (Clemens Lang), Dave-Allured (Dave Allured) |
Port: |
Description
I'm installing MacPorts non-root. Unfortunately, my group name has a space and backslash in it. This cannot be changed at my organization:
> whoami johndoe > id -g -n `whoami` NDC\Domain Users
MacPorts doesn't work when you try to ./configure and then make install. I currently have a workaround; the general idea is to use a numeric group ID instead of group name. First, I configure as follows (Python code here):
user_info = pwd.getpwuid(os.getuid()) self.pw_name = user_info[0] # pw_name self.pw_gid = user_info[3] # pw_gid cmd = ['./configure', '--enable-readline', '--prefix={}'.format(self.dest_dir), '--with-install-user={}'.format(self.pw_name), '--with-install-group={}'.format(self.pw_gid)] self.run_cmd(cmd, cwd=self.src_dir)
Then I apply the following patches on the generated files before running make:
file_replace(os.path.join(self.src_dir, 'doc/base.mtree'), 'gname', 'gid') file_replace(os.path.join(self.src_dir, 'doc/prefix.mtree'), 'gname', 'gid') file_replace(os.path.join(self.src_dir, 'doc/macosx.mtree'), 'uname=root gname=wheel', 'uname={} gid={}'.format(self.pw_name, self.pw_gid)) file_replace(os.path.join(self.src_dir, 'doc/macosx.mtree'), 'uname=root gname=admin', 'uname={} gid={}'.format(self.pw_name, self.pw_gid))
Would it be possible to update the core MacPorts so this patching is not required? Also... a similar fix would probably be needed for those poor souls with backslashes or spaces in their username.
Attachments (1)
Change History (17)
comment:1 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… added |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 9 years ago by citibob@…
Resolution: | invalid |
---|---|
Status: | closed → reopened |
I'm not going to dispute the logic of the above reply, and I agree 100% that spaces and backslashes in filenames are a BAD IDEA. However, we are stuck with them for all practical purposes. This computer network is at a large, well-known Federal agency --- almost certainly it's a Windows network at its core. The main job of IT is to make sure that people can run MS Office on their MS Desktops, and to deny root access to as many users as possible. Getting the latest GCC and boost running under MacPorts is NOT their job. You can guess how far I got when I submitted a ticket for this problem to them, asking them to fix the group names --- that's right, I didn't even get a reply.
There is often a difference between standard specs and facts on the ground. Spaces and backslashes are de facto legal in Mac group names, regardless of what the Open Group spec says. Asking Apple to make their system Open Group compliant in this regard (by rejecting illegal group names) will likely be as successful as my above efforts with our large Federal Agency IT department.
Therefore, we are stuck with these crazy group names, and MacPorts is the only viable place where the issue can be resolved. There seem to be two ways forward:
- Fix the issue, even thought it isn't really the "fault" of MacPorts. There are plenty of cases where software package A has to create a workaround for a bug in software package B.
- Decide that non-root MacPorts is not supported on the Macs in our large Federal agency because our systems don't (quite) conform to Open Group standards. This won't stop us from using it, because I've already created a workaround for the problem --- one that I would publish and share with others who also need to run MacPorts. But it would seem better if we could get this issue fixed the "right" way, rather than relying on my hackish post-configure Python script to do the job.
comment:3 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | chuck.fry@… added |
---|
Has duplicate #51232.
comment:4 Changed 9 years ago by chucko58 (Chuck Fry)
Unfortunately I'm in the same boat as the submitter, thus my duplicate report. This is a problem for those of us at federal agencies.
comment:5 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)
This may actually be a duplicate of #43875 which was fixed already in trunk, but was not backported to the 2.3 branch. So please try building trunk and let us know if it's fixed there or not.
comment:6 Changed 9 years ago by chucko58 (Chuck Fry)
This is broken in trunk as of 4/26/16 13:30 PST, but in a slightly different fashion, in an mtree script.
env PATH=/usr/bin:/bin:/usr/sbin:/sbin CFLAGS="-pipe -Os" ./configure --enable-readline --prefix=/Users/cfry --with-applications-dir=/Users/cfry/Applications --with-no-root-privileges make install
results in:
* Warning: Using pre-generated man pages only. * asciidoc, xsltproc (port libxslt) and docbook-xsl are required to generate man pages from source. /usr/bin/install -c -d -o "cfry" -g "NDC\Domain Users" -m "0755" "/Users/cfry" /usr/bin/install -c -d -o "cfry" -g "NDC\Domain Users" -m "0755" "/Users/cfry/etc/macports" < prefix.mtree /usr/sbin/mtree -U -e -p "/Users/cfry" > /dev/null mtree: line 6: unknown group NDC\Domain make[1]: *** [install] Error 1 make: *** [install] Error 1 rdnzl:base cfry$
I tried quoting the group name in base/doc/prefix.mtree, with no luck. Single quotes, double quotes, and backslashes in front of special characters all failed in the same way.
Changed 9 years ago by chucko58 (Chuck Fry)
'svn diff' of a fix against r148086
comment:7 Changed 9 years ago by chucko58 (Chuck Fry)
The attachment svn.diffs is the set of changes I had to make to get 'make install' to work on OS X 10.10.5. I hope you find it useful.
comment:9 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | cal@… added |
---|
Clemens, what do you think of this proposed patch?
comment:10 Changed 8 years ago by jmroot (Joshua Root)
We ship several of the modified files in the pkg, and I doubt we can rely on the gid being the same on every target machine.
comment:11 Changed 4 years ago by Dave-Allured (Dave Allured)
Cc: | Dave-Allured added |
---|
comment:12 Changed 4 years ago by Dave-Allured (Dave Allured)
comment:13 Changed 4 years ago by neverpanic (Clemens Lang)
comment:14 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
comment:15 Changed 11 months ago by jmroot (Joshua Root)
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:16 Changed 11 months ago by jmroot (Joshua Root)
Milestone: | → MacPorts 2.9.0 |
---|
I've never heard of a space or backslash being a legal character in a username or group name. I did a little research:
The Open Group Base Specification issue 7 has a definition of a user name and a group name that both say:
The definition of the portable filename character set says:
The backslash and the space are not part of that set of characters, so your group name is illegal on UNIX operating systems such as OS X. Please have your system administrator change your group name to one that is legal.