Re: Relative symlinks?
Jack Bates writes: > To move this forward, I submitted a review request [1] and picked gps > as the reviewer. If it shouldn't move forward, or there's a better > choice of reviewer, just let me know. For what it’s worth: Thank you for addressing this! I ran into issues with the absolute symlinks a while back when I tried mounting a build directory from the host on a Linux container to run some tests that required a special environment. ___ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds
Re: Relative symlinks?
On 24/10/16 02:40 PM, Jack Bates wrote: On 17/10/16 11:02 AM, Gregory Szorc wrote: On Sat, Oct 15, 2016 at 1:28 PM, Jack Bates mailto:tzm...@nottheoilrig.com>> wrote: What do you think about making the mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so symlink relative vs. absolute? When I follow these instructions [1] to build Firefox, I get the following error: > $ ./mach run > [...] > XPCOMGlueLoad error for file .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: > .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: cannot open shared object file: No such file or directory > $ mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so is a symlink to mozilla-central/obj-x86_64-pc-linux-gnu/dist/lib/libnssutil3.so, but the symlink is absolute, so if I move the source tree to another path, I get the error above. Could these symlinks be made relative vs. absolute? They probably could be. But it is a lot of work and isn't a high priority since very few people bring up this issue. Here's a rough patch for turning the absolute symlinks into relative ones. It works on my machine and resolves the issue above. Would you be willing to take a look? Are there any larger issues that I haven't considered? If not, would you be willing to help me polish it into something that could be accepted? To move this forward, I submitted a review request [1] and picked gps as the reviewer. If it shouldn't move forward, or there's a better choice of reviewer, just let me know. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1316735 ___ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds
Re: Relative symlinks?
On 17/10/16 11:02 AM, Gregory Szorc wrote: On Sat, Oct 15, 2016 at 1:28 PM, Jack Bates mailto:tzm...@nottheoilrig.com>> wrote: What do you think about making the mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so symlink relative vs. absolute? When I follow these instructions [1] to build Firefox, I get the following error: > $ ./mach run > [...] > XPCOMGlueLoad error for file .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: > .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: cannot open shared object file: No such file or directory > $ mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so is a symlink to mozilla-central/obj-x86_64-pc-linux-gnu/dist/lib/libnssutil3.so, but the symlink is absolute, so if I move the source tree to another path, I get the error above. Could these symlinks be made relative vs. absolute? They probably could be. But it is a lot of work and isn't a high priority since very few people bring up this issue. Here's a rough patch for turning the absolute symlinks into relative ones. It works on my machine and resolves the issue above. Would you be willing to take a look? Are there any larger issues that I haven't considered? If not, would you be willing to help me polish it into something that could be accepted? diff -r c845bfd0accb config/nsinstall.c --- a/config/nsinstall.cMon Oct 24 16:55:47 2016 +0200 +++ b/config/nsinstall.cMon Oct 24 13:26:17 2016 -0700 @@ -263,13 +263,13 @@ { int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen, bnlen, exists; mode_t mode = 0755; -char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, buf[BUFSIZ]; +char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, *absolute, buf[BUFSIZ]; uid_t uid; gid_t gid; struct stat sb, tosb, fromsb; program = argv[0]; -cwd = linkname = linkprefix = owner = group = 0; +cwd = linkname = absolute = linkprefix = owner = group = 0; onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0; while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) { @@ -379,33 +379,33 @@ if (access(name, R_OK) != 0) { fail("cannot access %s", name); } - if (*name == '/') { - /* source is absolute pathname, link to it directly */ - linkname = 0; - } else { if (linkprefix) { /* -L prefixes names with a $cwd arg. */ len += lplen + 1; linkname = xmalloc((unsigned int)(len + 1)); sprintf(linkname, "%s/%s", linkprefix, name); } else if (dorelsymlink) { + if (*name != '/') { + absolute = xmalloc((unsigned int)(strlen(cwd) + 1 + len + 1)); + sprintf(absolute, "%s/%s", cwd, name); + name = absolute; + } + /* Symlink the relative path from todir to source name. */ linkname = xmalloc(PATH_MAX); - if (*todir == '/') { /* todir is absolute: skip over common prefix. */ - lplen = relatepaths(todir, cwd, linkname); - strcpy(linkname + lplen, name); - } else { - /* todir is named by a relative path: reverse it. */ - reversepath(todir, name, len, linkname); - xchdir(cwd); + len = relatepaths(todir, name, linkname); + if (len > 0) { + linkname[--len] = '\0'; } - len = strlen(linkname); + if (absolute) { + free(absolute); + absolute = 0; + } } name = linkname; - } /* Check for a pre-existing symlink with identical content. */ if (exists && (!S_ISLNK(tosb.st_mode) || diff -r c845bfd0accb python/mozbuild/mozbuild/jar.py --- a/python/mozbuild/mozbuild/jar.py Mon Oct 24 16:55:47 2016 +0200 +++ b/python/mozbuild/mozbuild/jar.py Mon Oct 24 13:26:17 2016 -0700 @@ -545,6 +545,7 @@ if e.errno != errno.ENOENT: raise if sys.platform != 'win32': +src = os.path.relpath(src, os.path.dirname(out)) os.symlink(src, out) else: # On Win32, use ctypes to create a hardlink diff -r c845bfd0accb python/mozbuild/mozpack/files.py --- a/python/mozbuild/mozpack/files.py Mon Oct 24 16:55:47 2016 +0200 +++ b/python/mozbuild/mozpack/files.py Mon Oct 24 13:26:17 2016 -0700 @@ -323,23 +323,25 @@ if ose.errno != errno.ENOENT:
Re: Relative symlinks?
On Sat, Oct 15, 2016 at 1:28 PM, Jack Bates wrote: > What do you think about making the mozilla-central/obj-x86_64-pc- > linux-gnu/dist/bin/libnssutil3.so symlink relative vs. absolute? > When I follow these instructions [1] to build Firefox, I get the following > error: > > > $ ./mach run > > [...] > > XPCOMGlueLoad error for file .../mozilla-central/obj-x86_64 > -pc-linux-gnu/dist/bin/libnssutil3.so: > > .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: > cannot open shared object file: No such file or directory > > $ > > mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so is a > symlink to mozilla-central/obj-x86_64-pc-linux-gnu/dist/lib/libnssutil3.so, > but the symlink is absolute, so if I move the source tree to another path, > I get the error above. > Could these symlinks be made relative vs. absolute? > They probably could be. But it is a lot of work and isn't a high priority since very few people bring up this issue. ___ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds
Relative symlinks?
What do you think about making the mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so symlink relative vs. absolute? When I follow these instructions [1] to build Firefox, I get the following error: > $ ./mach run > [...] > XPCOMGlueLoad error for file .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: > .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: cannot open shared object file: No such file or directory > $ mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so is a symlink to mozilla-central/obj-x86_64-pc-linux-gnu/dist/lib/libnssutil3.so, but the symlink is absolute, so if I move the source tree to another path, I get the error above. Could these symlinks be made relative vs. absolute? [1] developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build ___ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds
Relative symlinks?
What do you think about making the mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so symlink relative vs. absolute? When I follow these instructions [1] to build Firefox, I get the following error: > $ ./mach run > [...] > XPCOMGlueLoad error for file .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: > .../mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so: cannot open shared object file: No such file or directory > $ mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libnssutil3.so is a symlink to mozilla-central/obj-x86_64-pc-linux-gnu/dist/lib/libnssutil3.so, but the symlink is absolute, so if I move the source tree to another path, I get the error above. Could these symlinks be made relative vs. absolute? [1] developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build ___ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds