Skip site navigation (1)Skip section navigation (2)
Date:      05 Aug 2002 10:17:13 -0400
From:      Joe Marcus Clarke <marcus@marcuscom.com>
To:        Mark Evenson <evenson@panix.com>
Cc:        ports@FreeBSD.ORG
Subject:   Re: [comp.unix.bsd.freebsd.misc] Problems building certain ports
Message-ID:  <1028557033.318.35.camel@gyros.marcuscom.com>
In-Reply-To: <a04re9a11w.fsf@panix3.panix.com>
References:  <a04re9a11w.fsf@panix3.panix.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-7dFpEIHK37tyvy2NzjiH
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Mon, 2002-08-05 at 09:27, Mark Evenson wrote:
> From: Mark Evenson <evenson@panix.com>
> Subject: Problems building certain ports
> Date: 05 Aug 2002 09:21:39 -0400
> 
> I have been having a problem building ports depending on the "in place"
> features of sed:  
> 
>      quid:/usr/ports/lang/guile$ make
>      ===>  Extracting for guile-1.4.1_2
>      >> Checksum OK for guile-1.4.1.tar.gz.
>      ===>   guile-1.4.1_2 depends on executable: libtool - found
>      ===>   guile-1.4.1_2 depends on shared library: ltdl.1 - found
>      ===>  Patching for guile-1.4.1_2
>      ===>  Applying FreeBSD patches for guile-1.4.1_2
>      sed: stdout: Bad file descriptor
>      *** Error code 1
> 
>      Stop in /usr/ports/lang/guile.
> 
> I have read what I could find about others having a similar problem, but it
> seems that I am experiencing something different.  My system is a freshly
> built STABLE-20020722, and my ports tree is also current, which should get
> me around the problems I have been able to find by searching the FreeBSD mailing
> list archives about not having the version of sed installed that takes the
> "-i" argument.
> 
> The one thing I did notice was that if I run the same command as root, it
> succeeds, which lead me to suspect that I was running into some sort of
> "limits" like restriction.  No amount of fooling with "limits", "ulimits",
> and the 'login.conf' database seems to allow me to get the port to compile
> as a regular user, so I have more or less given up on this line of thinking
> (unless root can *always* use as much resources as it needs regardless of
> the various settings of limits).  Also for the guile port, only some 105
> files are passed to the "xargs sed ..." part of the command, which if
> invoked "manually" (i.e. by cutting and pasting the arguments to sed rather
> than using xargs) succeeds, so it seems more like there is some bad
> interaction between 'xargs' and 'sed' here.
> 
> Can anyone shed some light on this problem?

This has to do with the permissions on the files being worked on by
sed.  You'll note for the guile, they're all 444.  During in-place
editing, sed reopens stdout to be the output filename.  It never checks
to see if this succeeds.  Therefore, the error perpetuates until it
tries to close a file descriptor that isn't open.

I'm not sure what the correct fix is here.  Certainly, we could modify
sed to do a chmod before reopening stdout to add write permissions for
the owner.  The attached patch does just that.

Joe 

> 
> Thanks,
> Mark
>  
> ----
> 

> 
> 
> -- 
> Mark Evenson <evenson@panix.com>
> 
> "A screaming comes across the sky.  It has happened before, but there is
> nothing to compare to it now."
-- 
PGP Key : http://www.marcuscom.com/pgp.asc

--=-7dFpEIHK37tyvy2NzjiH
Content-Disposition: attachment; filename=main.c.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=main.c.diff; charset=ISO8859-1

--- usr.bin/sed/main.c.orig	Mon Aug  5 10:16:06 2002
+++ usr.bin/sed/main.c	Mon Aug  5 10:16:26 2002
@@ -424,6 +424,9 @@
 		return -1;
 	}
=20
+	/* Make sure the file is writeable */
+	chmod(*filename, orig.st_mode | S_IWUSR);
+
 	if (*inplace =3D=3D '\0') {
 		char template[] =3D "/tmp/sed.XXXXXXXXXX";
=20

--=-7dFpEIHK37tyvy2NzjiH--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1028557033.318.35.camel>