Re: Regression in PREFIX handling in packages

2012-09-01 Thread Alexander Leidinger
On Wed, 29 Aug 2012 22:02:46 +0200 Alexander Leidinger
alexan...@leidinger.net wrote:

 And this one is tested (copypaste, may have lost tabs and add
 linebreaks from my mailer):
 ---snip---
 # svn diff
 Index: perform.c
 ===
 --- perform.c   (revision 239708)
 +++ perform.c   (working copy)
 @@ -215,10 +215,15 @@
 
  /* Prefix should add an @cwd to the packing list */
  if (Prefix) {
 -char resolved_prefix[PATH_MAX];
 -if (realpath(Prefix, resolved_prefix) == NULL)
 -   err(EXIT_FAILURE, couldn't resolve path for prefix: %s,
  Prefix);
 -   add_plist_top(plist, PLIST_CWD, resolved_prefix);
 +   if (Prefix[0] != '/') {
 +   char resolved_prefix[PATH_MAX];
 +   if (realpath(Prefix, resolved_prefix) == NULL)
 +   err(EXIT_FAILURE,
 +   couldn't resolve path for prefix: %s,
  Prefix);
 +   add_plist_top(plist, PLIST_CWD, resolved_prefix);
 +   } else {
 +   add_plist_top(plist, PLIST_CWD, Prefix);
 +   }
  }
 
  /* Add the origin if asked, at the top */
 ---snip---

Can I go ahead and commit this?

Bye,
Alexander.

-- 
http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-31 Thread Oliver Fromme
I think this might be related to this thread, so I'm
posting it as a follow-up ...

On some FreeBSD 8.x systems, I get the following error:

===  Deinstalling for security/ca_root_nss
readlink: illegal option -- f
usage: readlink [-n] [file ...]

It seems bsd.port.mk is trying to use /usr/bin/readlink
with the -f option when checking the PREFIX, but this
option isn't supported on all 8.x systems.

Wouldn't it make more sense to use /bin/realpath instead
of /usr/bin/readlink -f?  There's no reason to break
older system.

Best regards
   Oliver


-- 
Oliver Fromme, secnetix GmbH  Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

File names are infinite in length, where infinity is set to 255 characters.
-- Peter Collinson, The Unix File System
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-29 Thread Alexander Leidinger
On Sun, 26 Aug 2012 22:54:35 +0200 Alexander Leidinger
alexan...@leidinger.net wrote:

 Hi,
 
 I detected a regression in the handling of the registration of the
 PREFIX in packages. I'm not sure when it was introduced, surely more
 than a month ago.
 
 The problem:
  - I have a symlink from /usr/local to another place X.
  - I share packages between this system A and some jails.
  - The jails don't have place X and /usr/local is no symlink.
  - Packages generated on the system A are installed into place X in
the jails.
 
 So in short: the realpath of PREFIX is recorded in the packages, not
 the value of PREFIX as before.
 
 I had a quick look at bsd.*.mk, but didn't notice something obvious.
 So in case it is pkg_create which is doing this, I updated from
 r238438 to r239708.

Could it be that my problem comes from r231300 and I was lucky that I
didn't create a package on the machine with the symlinked /usr/local
and used it on a machine with a normal /usr/local?

% ll /usr/local
lrwxr-xr-x  1 root  wheel25B  2 Mai  2011 /usr/local@
- ../space/system/usr_local

http://svnweb.freebsd.org/base/head/usr.sbin/pkg_install/create/perform.c?r1=228990r2=231300

What's the problem this patch tries to solve? Shouldn't the plist use
the prefix as specified by the env variable instead of the realpath?

Bye,
Alexander.

-- 
http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-29 Thread Eitan Adler
On 29 August 2012 15:17, Alexander Leidinger alexan...@leidinger.net wrote:
 Could it be that my problem comes from r231300 and I was lucky that I
 didn't create a package on the machine with the symlinked /usr/local
 and used it on a machine with a normal /usr/local?

I have not been following this thread, so if you traced the bug to
this commit, I'll accept that.

 http://svnweb.freebsd.org/base/head/usr.sbin/pkg_install/create/perform.c?r1=228990r2=231300

 What's the problem this patch tries to solve? Shouldn't the plist use
 the prefix as specified by the env variable instead of the realpath?

The specific problem this patch was trying to solve is to allow the
use of . or other relative paths in the -p argument to pkg_create.



-- 
Eitan Adler
Source  Ports committer
X11, Bugbusting teams
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-29 Thread Alexander Leidinger
On Wed, 29 Aug 2012 15:28:36 -0400 Eitan Adler ead...@freebsd.org
wrote:

 On 29 August 2012 15:17, Alexander Leidinger
 alexan...@leidinger.net wrote:
  Could it be that my problem comes from r231300 and I was lucky that
  I didn't create a package on the machine with the
  symlinked /usr/local and used it on a machine with a
  normal /usr/local?
 
 I have not been following this thread, so if you traced the bug to
 this commit, I'll accept that.

It's a guess, I haven't tried to back it out and test again.

  http://svnweb.freebsd.org/base/head/usr.sbin/pkg_install/create/perform.c?r1=228990r2=231300
 
  What's the problem this patch tries to solve? Shouldn't the plist
  use the prefix as specified by the env variable instead of the
  realpath?
 
 The specific problem this patch was trying to solve is to allow the
 use of . or other relative paths in the -p argument to pkg_create.

Wouldn't it be better to use
---snip---
if (Prefix[0] != '/'  realpath(...
---snip---
in this case? Attention: I just guessed what Prefix is and what it
should contain by looking at the diff, I didn't had a look at the
declaraction and assignments of Prefix.

Bye,
Alexander.

-- 
http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-29 Thread Garrett Cooper
On Wed, Aug 29, 2012 at 12:48 PM, Alexander Leidinger
alexan...@leidinger.net wrote:
 On Wed, 29 Aug 2012 15:28:36 -0400 Eitan Adler ead...@freebsd.org
 wrote:

 On 29 August 2012 15:17, Alexander Leidinger
 alexan...@leidinger.net wrote:
  Could it be that my problem comes from r231300 and I was lucky that
  I didn't create a package on the machine with the
  symlinked /usr/local and used it on a machine with a
  normal /usr/local?

Symlinking would be a problem if you built it on one machine and
installed it on another.

...

 Wouldn't it be better to use
 ---snip---
 if (Prefix[0] != '/'  realpath(...
 ---snip---
 in this case? Attention: I just guessed what Prefix is and what it
 should contain by looking at the diff, I didn't had a look at the
 declaraction and assignments of Prefix.

That would cause problems in some cases where someone called
pkg_create -p /usr/foobar/../local

If this commit causes more harm than good, please back it out --
pkg_install is going to die soon anyhow, so I'd rather not fritter
away time debating its usefulness if it breaks a valid use case.

Thanks,
-Garrett
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-29 Thread Alexander Leidinger
On Wed, 29 Aug 2012 21:48:31 +0200 Alexander Leidinger
alexan...@leidinger.net wrote:

 On Wed, 29 Aug 2012 15:28:36 -0400 Eitan Adler ead...@freebsd.org
 wrote:
 
  On 29 August 2012 15:17, Alexander Leidinger
  alexan...@leidinger.net wrote:
   Could it be that my problem comes from r231300 and I was lucky
   that I didn't create a package on the machine with the
   symlinked /usr/local and used it on a machine with a
   normal /usr/local?
  
  I have not been following this thread, so if you traced the bug to
  this commit, I'll accept that.
 
 It's a guess, I haven't tried to back it out and test again.
 
   http://svnweb.freebsd.org/base/head/usr.sbin/pkg_install/create/perform.c?r1=228990r2=231300
  
   What's the problem this patch tries to solve? Shouldn't the plist
   use the prefix as specified by the env variable instead of the
   realpath?
  
  The specific problem this patch was trying to solve is to allow the
  use of . or other relative paths in the -p argument to pkg_create.
 
 Wouldn't it be better to use
 ---snip---
 if (Prefix[0] != '/'  realpath(...
 ---snip---
 in this case? Attention: I just guessed what Prefix is and what it
 should contain by looking at the diff, I didn't had a look at the
 declaraction and assignments of Prefix.

And this one is tested (copypaste, may have lost tabs and add
linebreaks from my mailer):
---snip---
# svn diff
Index: perform.c
===
--- perform.c   (revision 239708)
+++ perform.c   (working copy)
@@ -215,10 +215,15 @@

 /* Prefix should add an @cwd to the packing list */
 if (Prefix) {
-char resolved_prefix[PATH_MAX];
-if (realpath(Prefix, resolved_prefix) == NULL)
-   err(EXIT_FAILURE, couldn't resolve path for prefix: %s,
 Prefix);
-   add_plist_top(plist, PLIST_CWD, resolved_prefix);
+   if (Prefix[0] != '/') {
+   char resolved_prefix[PATH_MAX];
+   if (realpath(Prefix, resolved_prefix) == NULL)
+   err(EXIT_FAILURE,
+   couldn't resolve path for prefix: %s,
 Prefix);
+   add_plist_top(plist, PLIST_CWD, resolved_prefix);
+   } else {
+   add_plist_top(plist, PLIST_CWD, Prefix);
+   }
 }

 /* Add the origin if asked, at the top */
---snip---

Bye,
Alexander.

-- 
http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-29 Thread Alexander Leidinger
On Wed, 29 Aug 2012 12:59:30 -0700 Garrett Cooper yaneg...@gmail.com
wrote:

 On Wed, Aug 29, 2012 at 12:48 PM, Alexander Leidinger
 alexan...@leidinger.net wrote:
  On Wed, 29 Aug 2012 15:28:36 -0400 Eitan Adler ead...@freebsd.org
  wrote:
 
  On 29 August 2012 15:17, Alexander Leidinger
  alexan...@leidinger.net wrote:
   Could it be that my problem comes from r231300 and I was lucky
   that I didn't create a package on the machine with the
   symlinked /usr/local and used it on a machine with a
   normal /usr/local?
 
 Symlinking would be a problem if you built it on one machine and
 installed it on another.

I use this approach since years, and at least with the packages I
created on the machine with the symlink I never had problems.

This should only cause problems where realpath is used on
a dependency during the configuration/build of a port. I don't want to
rule out such a case, but I assume it is not a case one can fall into
much.

  Wouldn't it be better to use
  ---snip---
  if (Prefix[0] != '/'  realpath(...
  ---snip---
  in this case? Attention: I just guessed what Prefix is and what it
  should contain by looking at the diff, I didn't had a look at the
  declaraction and assignments of Prefix.
 
 That would cause problems in some cases where someone called
 pkg_create -p /usr/foobar/../local
 
 If this commit causes more harm than good, please back it out --
 pkg_install is going to die soon anyhow, so I'd rather not fritter
 away time debating its usefulness if it breaks a valid use case.

See my other mail, the patch there works for me. Only if the Prefix is
not an absolute path, the realpath is used.

Bye,
Alexander.

-- 
http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Regression in PREFIX handling in packages

2012-08-26 Thread Alexander Leidinger
Hi,

I detected a regression in the handling of the registration of the
PREFIX in packages. I'm not sure when it was introduced, surely more
than a month ago.

The problem:
 - I have a symlink from /usr/local to another place X.
 - I share packages between this system A and some jails.
 - The jails don't have place X and /usr/local is no symlink.
 - Packages generated on the system A are installed into place X in
   the jails.

So in short: the realpath of PREFIX is recorded in the packages, not
the value of PREFIX as before.

I had a quick look at bsd.*.mk, but didn't notice something obvious. So
in case it is pkg_create which is doing this, I updated from r238438
to r239708.

Bye,
Alexander.

-- 
http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Regression in PREFIX handling in packages

2012-08-26 Thread Bryan Drewery
On 8/26/2012 3:54 PM, Alexander Leidinger wrote:
 Hi,
 
 I detected a regression in the handling of the registration of the
 PREFIX in packages. I'm not sure when it was introduced, surely more
 than a month ago.


Are you using any tools for managing these packages? portmaster,
portupgrade?

Or just pkg_add -r?

 
 The problem:
  - I have a symlink from /usr/local to another place X.
  - I share packages between this system A and some jails.
  - The jails don't have place X and /usr/local is no symlink.
  - Packages generated on the system A are installed into place X in
the jails.
 
 So in short: the realpath of PREFIX is recorded in the packages, not
 the value of PREFIX as before.
 
 I had a quick look at bsd.*.mk, but didn't notice something obvious. So
 in case it is pkg_create which is doing this, I updated from r238438
 to r239708.
 
 Bye,
 Alexander.
 


-- 
Regards,
Bryan Drewery
bdrewery@freenode/EFNet
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org