Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Mar 2006 23:14:34 +0300
From:      Boris Samorodov <bsam@ipt.ru>
To:        Paul Schmehl <pauls@utdallas.edu>
Cc:        ports@FreeBSD.org
Subject:   Re: FreeBSD Port: mpack-1.6
Message-ID:  <25853573@srv.sem.ipt.ru>
In-Reply-To: <BDC46C39FADF0DDF8CFBCDA3@utd59514.utdallas.edu> (Paul Schmehl's message of "Wed, 01 Mar 2006 13:27:25 -0600")
References:  <44050D77.2030503@j2d.lam.net.au> <BCA5F50D2461133FF65B3BD8@utd59514.utdallas.edu> <84747890@srv.sem.ipt.ru> <C0D04BDAC59820A93DC4E43F@utd59514.utdallas.edu> <18666752@srv.sem.ipt.ru> <BDC46C39FADF0DDF8CFBCDA3@utd59514.utdallas.edu>

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

On Wed, 01 Mar 2006 13:27:25 -0600 Paul Schmehl wrote:
> --On Wednesday, March 01, 2006 22:21:35 +0300 Boris Samorodov
>   <bsam@ipt.ru> wrote:
> >> >
> >> I've already incorporated that patch in to the other one and deleted
> >> it, but that doesn't fix this bug.
> >
> > Hm:
> >
> > -----
> ># uname -a
> > FreeBSD srv.sem.ipt.ru 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #0: Tue Feb
> > 28 22:21:02 MSK 2006     bsam@srv.sem.ipt.ru:/usr/obj/usr/src/sys/SRV
> > i386
> >
> ># cd /usr/ports/converters/mpack
> ># rm files/patch-unixpk_c
> > (Makefile,v 1.18)
> ># make
> > ...
> ># cd work/mpack-1.6
> ># mkdir /usr/tmp
> ># ./mpack -s "test" Makefile bsam@ipt.ru
> >#
> > -----
> >
> > That's it. With that patch I've got "File exists" error.
> > Double check you additional patches?
> >
> Again, all the patches do is change a hard-coded path for TMPDIR
> from

Again, did you try to do what I wrote? Did you get errors?

> "/usr/tmp" to "/tmp".  They don't change anything else.  The program,
> bulit from source, fails with a "File or directory not found" error
> because the hard-coded path, "/usr/tmp", does not exist.  When you fix
> *that* problem (by applying my patches), you get a different error,
> "File already exists", in the same place in the code.

Yes. And I show you how to override that error. Just delete the patch
file.

BTW if you read README.unix at the sources you may see that one can
change the hard-coded path. Just define environment variable
TMPDIR=/tmp. No C-coding. Just simple. Test it! (I did)

> There's a bug in the program that is not allowing the program to open
> a file in "/tmp" and write to it, then complete its work and exit
> successfully.

The bug is introduced by the patch. Restore the port from cvs (cvsup)
and just delete the patch. And define TMPDIR.

> My problem is, I'm not a programmer, and my C skills are not that
> good, so I'm having problems figuring out what's causing the error
> (other than the fact that I know it creates the file, and then, when
> it tries to write to it, complains that the file already exists (which
> seems kind of silly to me.)

> There's not a problem with my patches, AFAICT, there's a problem with
> the program.  If there's any programmers on this list, who have the

There is no problem with the program. There is a problem with your
patches.

> time, I could use some help tracking this down.  I emailed the
> developers, but I don't know if they'll get back to me or not.

I'm also not a C programmer. But here is the patch you asked for:

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=mpack.patch
Content-Description: mpack patch

diff -ruN mpack.orig/files/patch-unixos_c mpack/files/patch-unixos_c
--- mpack.orig/files/patch-unixos_c	Thu Jan  1 03:00:00 1970
+++ mpack/files/patch-unixos_c	Wed Mar  1 22:47:24 2006
@@ -0,0 +1,11 @@
+--- unixos.c.orig	Wed Mar  1 22:45:13 2006
++++ unixos.c	Wed Mar  1 22:46:49 2006
+@@ -90,7 +90,7 @@
+ 	strcpy(buf, getenv("TMPDIR"));
+     }
+     else {
+-	strcpy(buf, "/usr/tmp");
++	strcpy(buf, "/tmp");
+     }
+     strcat(buf, "/m-prts-");
+     p = getenv("USER");
diff -ruN mpack.orig/files/patch-unixpk_c mpack/files/patch-unixpk_c
--- mpack.orig/files/patch-unixpk_c	Wed Mar  1 22:39:37 2006
+++ mpack/files/patch-unixpk_c	Wed Mar  1 22:50:31 2006
@@ -1,12 +1,12 @@
 $OpenBSD: patch-unixpk_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
 --- unixpk.c.orig	Thu Feb 16 22:39:50 1995
 +++ unixpk.c	Mon Aug  5 12:30:30 2002
-@@ -165,7 +165,7 @@ char **argv;
- 	    strcpy(fnamebuf, "/tmp");
+@@ -164,7 +164,7 @@
+ 	    strcpy(fnamebuf, getenv("TMPDIR"));
+ 	}
+ 	else {
+-	    strcpy(fnamebuf, "/usr/tmp");
++	    strcpy(fnamebuf, "/tmp");
  	}
  	strcat(fnamebuf, "/mpackXXXXXX");
--	mktemp(fnamebuf);
-+	close(mkstemp(fnamebuf));
- 	outfname = strsave(fnamebuf);
-     }
- 
+ 	close(mkstemp(fnamebuf));

--=-=-=


What it does:
1. Rewrites "/usr/tmp" to "/tmp".
2. Deletes changes from previous files/patch-unixpk_c.

Just what I told you to do.

To use the patch:

# cd /usr/ports/converters
# patch -p0 < _the_patch_
(delete files/*.orig files)
# make all install clean


WBR
-- 
Boris B. Samorodov, Research Engineer
InPharmTech Co,     http://www.ipt.ru
Telephone & Internet Service Provider

--=-=-=--



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