Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 May 1998 20:31:44 -0500
From:      Dave Glowacki <dglo@SSEC.WISC.EDU>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   ports/6530: Patch for devel/prc-tools 
Message-ID:  <199805060131.UAA11369@tick.ssec.wisc.edu>

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

>Number:         6530
>Category:       ports
>Synopsis:       build-prc mishandles path arguments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May  5 18:40:02 PDT 1998
>Last-Modified:
>Originator:     Dave Glowacki
>Organization:
>Release:        FreeBSD 2.2.6-STABLE i386
>Environment:
>Description:

	'build-prc' only knows how to deal with pilrc-generated filenames
	in the current directory.  If told to use a file from a subdirectory,
	it takes the first 4 characters in the path as the resource name
	and tries to interpret the rest of the path as a hexadecimal ID
	number.

>How-To-Repeat:

	Tell pilrc to generate it's resources in a subdirectory with
	a command line:


		pilrc foo.rcp foo.bin

	(where foo.bin is a directory) then link the final executable
	like this:

		build-prc foo.prc Foo FooB code0001.foo.grc \
			code0000.foo.grc data0000.foo.grc foo.bin/*.bin \
			pref0000.foo.grc rloc0000.foo.grc

	build-prc will incorrectly link in the resources in foo.bin/

>Fix:

	Apply the following patch:

*** build-prc.c.orig	Fri Jun 27 11:59:32 1997
--- build-prc.c	Tue May  5 20:14:22 1998
***************
*** 9,14 ****
--- 9,15 ----
  #include <stdio.h>
  #include <fcntl.h>
  #include <stdlib.h>
+ #include <string.h>
  #include "prc.h"
  
  #ifdef __CYGWIN32__
***************
*** 17,22 ****
--- 18,38 ----
  #define O_PLATFORM 0
  #endif
  
+ char *
+ basename(char *path)
+ {
+   char *name;
+ 
+   name = strrchr(path, '/');
+   if (name) {
+     name++;
+   } else {
+     name = path;
+   }
+ 
+   return name;
+ }
+ 
  main(int argc, char *argv[])
  {
    pfd_t *pf;
***************
*** 64,69 ****
--- 80,87 ----
    /* the .prc write routines write the resources in reverse order! */
  
    for (i=argc-1; i > optind + 2; i--) {
+     char *name;
+ 
      if ((fd = open(argv[i], O_PLATFORM | O_RDONLY)) < 1) {
        fprintf(stderr, "Can't open resource file %s\n",argv[i]);
        exit(3);
***************
*** 76,82 ****
      read(fd, sd, slen);
      close (fd);
  
!     add_section_pfd(pf, argv[i], strtoul(argv[i] + 4, (void *)0, 16),
  		    sd, slen);
    }
  
--- 94,101 ----
      read(fd, sd, slen);
      close (fd);
  
!     name = basename(argv[i]);
!     add_section_pfd(pf, name, strtoul(name + 4, (void *)0, 16),
  		    sd, slen);
    }
  
>Audit-Trail:
>Unformatted:

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?199805060131.UAA11369>