On 19 January 2011 ?. 19:56:34 Stuart Henderson wrote:
> On 2011/01/19 09:41, Marco Peereboom wrote:
> > Since I don't know how to fix this, can someone send me a correct diff?
>
> see below, I think this one is better.
>
> I cleaned up whitespace a bit too, sorted WANTLIB, and added a patch
> to fix a typo in xxxterm.desktop (which makes the patch slightly annoying
> to apply to a tree which you might commit from; cd /usr/ports/www/xterm;
> cvs up -dA (** NO -P **); then you can patch with -E -p0).
>
> > > > you can also just use
> > > > ${SUBST_CMD} -o ${SHAREOWN} -g ${SHAREGRP} -c ${WRKSRC}/xxxterm.desktop
> > > > ${PREFIX}/share/applications/xxxterm.desktop
> > > > instead of doing install+subst
> > >
> > > But then you have to do chown anyway, since SUBST_CMD does not support
> > > "-m mode" switch.
>
> if the desktop file had been in the ports tree instead (e.g. in
> www/xterm/files) then we could not rely on the mode as the tree
> might have been checked out with umask 002. but it's ok here,
> because the file is in the tarball with the correct permissions
> (pkg_subst just copies the existing permissions - I wouldn't
> oppose -m support for pkg_subst, I think it was discussed before
> but I don't recall the outcome).
The file is there with 0644 permissions, and ${SHAREMODE} is 0444.
Whatever it worth, below is pkg_subst patch.
--
Best wishes,
Vadim Zhukov
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
Index: pkg_subst
===================================================================
RCS file: /cvs/ports/infrastructure/bin/pkg_subst,v
retrieving revision 1.1
diff -u -p -r1.1 pkg_subst
--- pkg_subst 20 Aug 2010 14:38:31 -0000 1.1
+++ pkg_subst 19 Jan 2011 18:13:03 -0000
@@ -28,14 +28,14 @@ use OpenBSD::IdCache;
my $subst = OpenBSD::Subst->new;
our $opt_c;
-my ($fuid, $fgid);
+my ($fuid, $fgid, $fmode);
my ($uidc, $gidc);
my $ui = OpenBSD::State->new('pkg_subst');
-$ui->usage_is( '[-c] [-Dvar=value ...] [-g group] [-o owner] [file ...]');
+$ui->usage_is( '[-c] [-Dvar=value ...] [-g group] [-m mode] [-o owner] [file
...]');
$ui->do_options(
sub {
- getopts('D:g:o:ch',
+ getopts('D:g:m:o:ch',
{'D' =>
sub {
$subst->parse_option(shift);
@@ -54,6 +54,13 @@ $ui->do_options(
$fgid = $gidc->lookup($group, -1);
die "$group is not a valid group" if $fgid == -1;
},
+ 'm' => sub {
+ my $mode = shift;
+
+ die "$mode is not a valid file mode"
+ if $mode !~ /0*[0-7]{3,4}/;
+ $fmode = oct($mode);
+ },
'h' => sub { $ui->usage; },
});
});
@@ -79,6 +86,7 @@ while (my $src = shift) {
my $fh = $subst->copy($src, $dest);
# copy rights, owner, group as well
my ($uid, $gid, $mode) = (stat $src)[4, 5, 2];
+ $mode = $fmode if defined $fmode;
my $r1 = chown $fuid // $uid, $fgid // $gid, $fh;
my $r2 = chmod $mode & 07777, $fh;
if (defined $fuid || defined $fgid || $< == 0) {