RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: file/src/ compress.c rpm/ CHANGES rpm/lib/ rpmfc.c rpm/rpmd...

From: Jeff Johnson <n3npq@mac.com>
Date: Thu 25 Dec 2008 - 20:02:35 CET
Message-id: <02DB0258-441E-4267-ACA4-D695DF3E0545@mac.com>
Maintaining internal file sources @rpm5.org
is nowhere near as useful as sending same patches
upstream.

The __ONLY_ reason for internal file @rpm5.org is to permit
control of /etc/magic (yes I know the FHS path) content
when building *.rpm packages. The contents from
whatever /etc/magic is used during build __WILL__
end-up in *.rpm metadata, and hence becomes a rpmbuild
problem because rpm uses -lmagic.

73 de Jeff

On Dec 24, 2008, at 9:27 PM, Per Řyvind Karlsen wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/
>   
> ____________________________________________________________________________
>
>  Server: rpm5.org                         Name:   Per Řyvind Karlsen
>  Root:   /v/rpm/cvs                       Email:  pkarlsen@rpm5.org
>  Module: rpm file                         Date:   25-Dec-2008 03:27:16
>  Branch: HEAD                             Handle: 2008122502271402
>
>  Modified files:
>    file/src                compress.c
>    rpm                     CHANGES rpmqv.c
>    rpm/lib                 rpmfc.c
>    rpm/rpmdb               signature.c
>    rpm/rpmio               macro.c
>    rpm/tools               rpmmtree.c rpmspecdump.c
>
>  Log:
>    check return value for functions declared with attribute  
> warn_unused_result.
>    (some inspired by rpm.org)
>
>  Summary:
>    Revision    Changes     Path
>    1.22        +6  -3      file/src/compress.c
>    1.2706      +2  -0      rpm/CHANGES
>    1.56        +4  -2      rpm/lib/rpmfc.c
>    1.58        +4  -1      rpm/rpmdb/signature.c
>    2.211       +2  -1      rpm/rpmio/macro.c
>    1.154       +4  -1      rpm/rpmqv.c
>    2.4         +9  -3      rpm/tools/rpmmtree.c
>    2.7         +21 -3      rpm/tools/rpmspecdump.c
>   
> ____________________________________________________________________________
>
>  patch -p0 <<'@@ .'
>  Index: file/src/compress.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.21 -r1.22 compress.c
>  --- file/src/compress.c	15 Dec 2008 23:04:37 -0000	1.21
>  +++ file/src/compress.c	25 Dec 2008 02:27:15 -0000	1.22
>  @@ -395,16 +395,19 @@
>   	case 0:	/* child */
>   		(void) close(0);
>   		if (fd != -1) {
>  -		    (void) dup(fd);
>  +		    if (dup(fd) < 0)
>  +    			perror("dup");
>   		    (void) lseek(0, (off_t)0, SEEK_SET);
>   		} else {
>  -		    (void) dup(fdin[0]);
>  +		    if (dup(fdin[0]) < 0)
>  +			perror("dup");
>   		    (void) close(fdin[0]);
>   		    (void) close(fdin[1]);
>   		}
>
>   		(void) close(1);
>  -		(void) dup(fdout[1]);
>  +		if (dup(fdout[1]) < 0)
>  +		    perror("dup");
>   		(void) close(fdout[0]);
>   		(void) close(fdout[1]);
>   #ifndef DEBUG
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/CHANGES
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.2705 -r1.2706 CHANGES
>  --- rpm/CHANGES	24 Dec 2008 15:55:43 -0000	1.2705
>  +++ rpm/CHANGES	25 Dec 2008 02:27:14 -0000	1.2706
>  @@ -1,5 +1,7 @@
>
>   5.2a2 -> 5.2a3:
>  +    - proyvind: check return value for functions declared with  
> attribute
>  +	warn_unused_result. (some inspired by rpm.org)
>       - proyvind: debugedit: perform some cleanups and pull in some  
> from rpm.org
>   	as well while at it.
>       - proyvind: move comparision of DISTEPOCH under NOTYET &
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/lib/rpmfc.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.55 -r1.56 rpmfc.c
>  --- rpm/lib/rpmfc.c	13 Dec 2008 20:37:56 -0000	1.55
>  +++ rpm/lib/rpmfc.c	25 Dec 2008 02:27:15 -0000	1.56
>  @@ -77,9 +77,11 @@
>       /*@=type@*/
>
>       toProg[0] = toProg[1] = 0;
>  -    (void) pipe(toProg);
>       fromProg[0] = fromProg[1] = 0;
>  -    (void) pipe(fromProg);
>  +    if (pipe(toProg) < 0 || pipe(fromProg) < 0) {
>  +	rpmlog(RPMLOG_ERR, _("Couldn't create pipe for %s: %m\n"),  
> argv[0]);
>  +	return NULL;
>  +    }
>
>       if (!(child = fork())) {
>   	(void) close(toProg[1]);
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/rpmdb/signature.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.57 -r1.58 signature.c
>  --- rpm/rpmdb/signature.c	13 Dec 2008 22:56:33 -0000	1.57
>  +++ rpm/rpmdb/signature.c	25 Dec 2008 02:27:15 -0000	1.58
>  @@ -170,7 +170,10 @@
>       addMacro(NULL, "__signature_filename", NULL, sigfile, -1);
>
>       inpipe[0] = inpipe[1] = 0;
>  -    (void) pipe(inpipe);
>  +    if (pipe(inpipe) < 0) {
>  +	rpmlog(RPMLOG_ERR, _("Couldn't create pipe for signing: %m"));
>  +	return 1;
>  +    }
>
>       if (!(pid = fork())) {
>   	const char *gpg_path = rpmExpand("%{?_gpg_path}", NULL);
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/rpmio/macro.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r2.210 -r2.211 macro.c
>  --- rpm/rpmio/macro.c	20 Dec 2008 22:56:34 -0000	2.210
>  +++ rpm/rpmio/macro.c	25 Dec 2008 02:27:15 -0000	2.211
>  @@ -1344,7 +1344,8 @@
>   	    be++;
>   /*@=globs@*/
>   #if defined(HAVE_MKDTEMP) && !defined(__LCLINT__)
>  -	(void) mkdtemp(b);
>  +	if (mkdtemp(b) == NULL)
>  +	    perror("mkdtemp");
>   #else
>   	if ((b = tmpnam(b)) != NULL)
>   	    (void) mkdir(b, 0700);	/* XXX S_IWRSXU is not included. */
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/rpmqv.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.153 -r1.154 rpmqv.c
>  --- rpm/rpmqv.c	14 Nov 2008 10:01:25 -0000	1.153
>  +++ rpm/rpmqv.c	25 Dec 2008 02:27:14 -0000	1.154
>  @@ -728,7 +728,10 @@
>   #endif	/* IAM_RPMBT || IAM_RPMK */
>
>       if (rpmioPipeOutput) {
>  -	(void) pipe(p);
>  +	if (pipe(p) < 0) {
>  +	    fprintf(stderr, _("creating a pipe for --pipe failed: %m\n"));
>  +	    goto exit;
>  +	}
>
>   	if (!(pipeChild = fork())) {
>   	    (void) close(p[1]);
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/tools/rpmmtree.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r2.3 -r2.4 rpmmtree.c
>  --- rpm/tools/rpmmtree.c	28 Jul 2008 14:35:26 -0000	2.3
>  +++ rpm/tools/rpmmtree.c	25 Dec 2008 02:27:16 -0000	2.4
>  @@ -2004,19 +2004,25 @@
>   	}
>   /*@-noeffectuncon -unrecog@*/
>   	if (c1 == NULL && c2->type == F_DIR) {
>  -	    asprintf(&np, "%s%s/", path, c2->name);
>  +	    if(asprintf(&np, "%s%s/", path, c2->name)) {
>  +		perror("asprintf");
>  +	    }
>   	    i = mtreeSWalk(c1, c2, np);
>   	    free(np);
>   	    i += compare_nodes(c1, c2, path);
>   	} else if (c2 == NULL && c1->type == F_DIR) {
>  -	    asprintf(&np, "%s%s/", path, c1->name);
>  +	    if(asprintf(&np, "%s%s/", path, c1->name)) {
>  +		perror("asprintf");
>  +	    }
>   	    i = mtreeSWalk(c1, c2, np);
>   	    free(np);
>   	    i += compare_nodes(c1, c2, path);
>   	} else if (c1 == NULL || c2 == NULL) {
>   	    i = compare_nodes(c1, c2, path);
>   	} else if (c1->type == F_DIR && c2->type == F_DIR) {
>  -	    asprintf(&np, "%s%s/", path, c1->name);
>  +	    if(asprintf(&np, "%s%s/", path, c1->name)) {
>  +		perror("asprintf");
>  +	    }
>   	    i = mtreeSWalk(c1, c2, np);
>   	    free(np);
>   	    i += compare_nodes(c1, c2, path);
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/tools/rpmspecdump.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r2.6 -r2.7 rpmspecdump.c
>  --- rpm/tools/rpmspecdump.c	31 Jul 2008 00:21:43 -0000	2.6
>  +++ rpm/tools/rpmspecdump.c	25 Dec 2008 02:27:16 -0000	2.7
>  @@ -118,13 +118,31 @@
>       ssize_t		cnt;
>   };
>
>  +static inline void safe_write(int fd, const char *buf, size_t count)
>  +{
>  +  ssize_t written;
>  +
>  +  do {
>  +    written = write(fd, buf, count);
>  +    if ((size_t)written == count)
>  +      break;
>  +    if (written > 0) {
>  +      buf += written;
>  +      count -= written;
>  +    }
>  +  } while (written >= 0 || errno == EINTR);
>  +  if (written < 0) {
>  +	  perror("write");
>  +  }
>  +}
>  +
>   inline static void
>   writeStr(int fd, char const *cmd)
>   {
>  -  (void)write(fd, cmd, strlen(cmd));
>  +  safe_write(fd, cmd, strlen(cmd));
>   }
>
>  -#define WRITE_MSG(FD,X)		(void)(write(FD,X,sizeof(X)-1))
>  +#define WRITE_MSG(FD,X)		safe_write(FD,X,sizeof(X)-1)
>   #define WRITE_STR(FD,X)		writeStr(FD,X)
>
>   static void
>  @@ -213,7 +231,7 @@
>     }
>
>     if (optind+1!=argc) {
>  -    write(2, "No/too much specfile(s) given; aborting\n", 40);
>  +    safe_write(2, "No/too much specfile(s) given; aborting\n", 40);
>       exit(1);
>     }
>
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org



  • application/pkcs7-signature attachment: smime.p7s
Received on Thu Dec 25 20:02:42 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.