Debian Bug report logs -
#12240
dpkg-deb --build doesn't obey $TMPDIR
Toggle useless messages
Report forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
:
Bug#12240
; Package dpkg
.
(full text, mbox, link).
Acknowledgement sent to "Mark W. Eichin" <eichin@kitten.gen.ma.us>
:
New bug report received and forwarded. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
.
(full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: dpkg
Version: 1.4.0.19
% ( setenv TMPDIR /var/bigtmp ; dpkg --build debian/tmp-xbooks .. )
dpkg-deb: building package `xbooks' in `../xbooks_3.3-5_all.deb'.
gzip: stdout: No space left on device
dpkg-deb: subprocess gzip -9c from tar --exclude returned error exit status 1
strace shows it using /tmp; /tmp has about 2M, /var/bigtmp has about 150M...
Information forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
:
Bug#12240
; Package dpkg
.
(full text, mbox, link).
Acknowledgement sent to Juan Cespedes <cespedes@debian.org>
:
Extra info received and forwarded to list. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
.
(full text, mbox, link).
Message #10 received at 12240@bugs.debian.org (full text, mbox, reply):
reassign 12240 libc6
retitle 12240 tmpdir,tmpnam should obey $TMPDIR
thanks
From: "Mark W. Eichin" <eichin@kitten.gen.ma.us>
> % ( setenv TMPDIR /var/bigtmp ; dpkg --build debian/tmp-xbooks .. )
> dpkg-deb: building package `xbooks' in `../xbooks_3.3-5_all.deb'.
>
> gzip: stdout: No space left on device
> dpkg-deb: subprocess gzip -9c from tar --exclude returned error exit status 1
>
> strace shows it using /tmp; /tmp has about 2M, /var/bigtmp has about 150M...
`dpkg-deb' uses tmpdir() and tmpnam() to get access to temp
files, so I'm reassigning this bug to libc6.
Thanks.
--
Juan Cespedes
Bug reassigned from package `dpkg' to `libc6'.
Request was from Juan Cespedes <cespedes@debian.org>
to control@bugs.debian.org
.
(full text, mbox, link).
Changed bug title.
Request was from Juan Cespedes <cespedes@debian.org>
to control@bugs.debian.org
.
(full text, mbox, link).
Information forwarded to debian-bugs-dist@lists.debian.org, Dale Scheetz <dwarf@polaris.net>
:
Bug#12240
; Package libc6
.
(full text, mbox, link).
Acknowledgement sent to James Troup <J.J.Troup@scm.brad.ac.uk>
:
Extra info received and forwarded to list. Copy sent to Dale Scheetz <dwarf@polaris.net>
.
(full text, mbox, link).
Message #19 received at 12240@bugs.debian.org (full text, mbox, reply):
reassign 12240 dpkg
retitle 12240 dpkg-deb --build doesn't obey $TMPDIR
thanks
(Reassigned back because you're not the maintainer and the reason you
gave for reassignment was bgous. I'm not the maintainer either (or
even anything to with dpkg), but I'm just restoring things to how they
were)
Juan Cespedes <cespedes@debian.org> writes:
> reassign 12240 libc6
> retitle 12240 tmpdir,tmpnam should obey $TMPDIR
> thanks
>
> From: "Mark W. Eichin" <eichin@kitten.gen.ma.us>
> > % ( setenv TMPDIR /var/bigtmp ; dpkg --build debian/tmp-xbooks .. )
> > dpkg-deb: building package `xbooks' in `../xbooks_3.3-5_all.deb'.
> >
> > gzip: stdout: No space left on device
> > dpkg-deb: subprocess gzip -9c from tar --exclude returned error exit status 1
> >
> > strace shows it using /tmp; /tmp has about 2M, /var/bigtmp has about 150M...
>
> `dpkg-deb' uses tmpdir() and tmpnam() to get access to temp
> files, so I'm reassigning this bug to libc6.
No it does not[1]. When building dpkg-deb uses tmpfile(), which uses
a hardcoded path (in <stdio.h>)[2] for finding the tmp directory and
this is the documented behaviour of that function. Presumably Mark
wants dpkg-deb to use something which obeys $TMPDIR, e.g. tempnam.
If you think the API of tmpfile and friends should change, please open
a separate bug report against libc6.
Juan, WTF are you doing?
[1]
15:04:08@dcsun4| ~/temp/dpkg-1.4.0.21/dpkg-deb $grep tmp *.c
build.c: if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (control)"));
build.c: if (fstat(fileno(gz),&controlstab)) ohshite(_("failed to fstat tmpfile (control)"));
build.c: if (lseek(fileno(gz),0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (control)"));
build.c: if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (data)"));
build.c: if (fstat(fileno(gz),&datastab)) ohshite("_(failed to fstat tmpfile (data))");
build.c: if (lseek(fileno(gz),0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (data)"));
info.c: static char dbuf[L_tmpnam];
info.c: if (!tmpnam(dbuf)) ohshite(_("failed to make temporary filename"));
15:04:11@dcsun4| ~/temp/dpkg-1.4.0.21/dpkg-deb $
[2]
| DESCRIPTION
| The tmpfile() function generates a unique temporary file
| name using the path prefix P_tmpdir defined in <stdio.h>.
-- tmpfile(3)
--
James
Bug reassigned from package `libc6' to `dpkg'.
Request was from James Troup <J.J.Troup@scm.brad.ac.uk>
to control@bugs.debian.org
.
(full text, mbox, link).
Changed bug title.
Request was from James Troup <J.J.Troup@scm.brad.ac.uk>
to control@bugs.debian.org
.
(full text, mbox, link).
Information forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
:
Bug#12240
; Package dpkg
.
(full text, mbox, link).
Acknowledgement sent to Topi Miettinen <Topi.Miettinen@medialab.sonera.net>
:
Extra info received and forwarded to list. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
.
(full text, mbox, link).
Message #28 received at 12240@bugs.debian.org (full text, mbox, reply):
This patch attempts to fix the problem.
diff -ru dpkg-1.4.0.23.2/dpkg-deb/build.c.orig dpkg-1.4.0.23.2/dpkg-deb/build.c
--- dpkg-1.4.0.23.2/dpkg-deb/build.c.orig Sat Mar 8 21:40:47 1997
+++ dpkg-1.4.0.23.2/dpkg-deb/build.c Fri Jul 3 22:45:48 1998
@@ -57,13 +57,13 @@
PREINSTFILE, POSTINSTFILE, PRERMFILE, POSTRMFILE, 0
};
- char *m;
+ char *m, *tmpd, *tmpf;
const char *debar, *directory, *const *mscriptp, *versionstring, *arch;
char *controlfile;
struct pkginfo *checkedinfo;
struct arbitraryfield *field;
FILE *ar, *gz, *cf;
- int p1[2],p2[2], warns, errs, n, c, subdir;
+ int p1[2],p2[2], warns, errs, n, c, subdir, gzfd;
pid_t c1,c2,c3,c4,c5;
struct stat controlstab, datastab, mscriptstab, debarstab;
char conffilename[MAXCONFFILENAME+1];
@@ -208,7 +208,14 @@
execlp(TAR,"tar","-cf","-",".",(char*)0); ohshite(_("failed to exec tar -cf"));
}
close(p1[1]);
- if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (control)"));
+
+ if (!(tmpd = getenv("TMPDIR")))
+ tmpd= "/tmp";
+ tmpf= malloc(strlen(tmpd) + strlen("/dpkg.XXXXXX"));
+ strcpy(tmpf, tmpd);
+ strcat(tmpf, "/dpkg.XXXXXX");
+ if (!(gzfd= mkstemp(tmpf)) || !(gz= fdopen(gzfd, "r+")))
+ ohshite(_("failed to make tmpfile (control)"));
if (!(c2= m_fork())) {
m_dup2(p1[0],0); m_dup2(fileno(gz),1); close(p1[0]);
execlp(GZIP,"gzip","-9c",(char*)0); ohshite(_("failed to exec gzip -9c"));
@@ -245,8 +252,12 @@
if (!oldformatflag) {
fclose(gz);
- if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (data)"));
+ strcpy(tmpf, tmpd);
+ strcat(tmpf, "/dpkg.XXXXXX");
+ if (!(gzfd= mkstemp(tmpf)) || !(gz= fdopen(gzfd, "r+")))
+ ohshite(_("failed to make tmpfile (data)"));
}
+ free(tmpf);
m_pipe(p2);
if (!(c4= m_fork())) {
m_dup2(p2[1],1); close(p2[0]); close(p2[1]);
diff -ru dpkg-1.4.0.23.2/dpkg-deb/info.c.orig dpkg-1.4.0.23.2/dpkg-deb/info.c
--- dpkg-1.4.0.23.2/dpkg-deb/info.c.orig Sat Mar 8 22:02:47 1997
+++ dpkg-1.4.0.23.2/dpkg-deb/info.c Fri Jul 3 22:41:48 1998
@@ -59,12 +59,13 @@
const char **debarp,
const char **directoryp,
int admininfo) {
- static char dbuf[L_tmpnam];
+ char *dbuf;
pid_t c1;
*debarp= *(*argvp)++;
if (!*debarp) badusage(_("--%s needs a .deb filename argument"),cipaction->olong);
- if (!tmpnam(dbuf)) ohshite(_("failed to make temporary filename"));
+ dbuf = tempnam(NULL, "dpkg");
+ if (!dbuf) ohshite(_("failed to make temporary filename"));
*directoryp= dbuf;
if (!(c1= m_fork())) {
@@ -73,6 +74,7 @@
waitsubproc(c1,"rm -rf",0);
push_cleanup(cu_info_prepare,-1, 0,0, 1, (void*)dbuf);
extracthalf(*debarp, dbuf, "mx", admininfo);
+ free(dbuf);
}
static int ilist_select(const struct dirent *de) {
Information forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
:
Bug#12240
; Package dpkg
.
(full text, mbox, link).
Acknowledgement sent to Ian Jackson <ian@chiark.greenend.org.uk>
:
Extra info received and forwarded to list. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
.
(full text, mbox, link).
Message #33 received at 12240@bugs.debian.org (full text, mbox, reply):
The patch from Topi Miettinen should not be applied. I agree with
Juan that this is a bug in the libc (though I also agree with James
Troup that he should probably not have reassigned the bug).
tmpfile() is documented in the glibc info file as:
- Function: FILE * tmpfile (void)
This function creates a temporary binary file for update mode, as
if by calling `fopen' with mode `"wb+"'. The file is deleted
automatically when it is closed or when the program terminates.
(On some other ANSI C systems the file may fail to be deleted if
the program terminates abnormally).
Nowhere in this document does it say that tmpfile has the behaviour
that it's hardwired to use /tmp. In fact, I think that such behaviour
is broken, and should be fixed. I'm therefore going to reassign this
bug back to libc6.
I strongly suspect that the manpage for tmpfile was written with
reference to the implementation, rather than as a specification. As
such it should not be considered canonical. Even if it is to be
considered canonical, the behaviour documented in tmpfile(3) is still
broken, and so the documentation should be changed. I'm therefore
also going to include manpages in the list of packages to which I'll
reassign the bug.
I'd be grateful if the manpages and/or libc maintainers would reassign
the bug to the other package when they have fixed their part of the
bug.
Thanks,
Ian.
Information forwarded to debian-bugs-dist@lists.debian.org, Dale Scheetz <dwarf@polaris.net>, Nicol�s Lichtmaier <nick@feedback.net.ar>
:
Bug#12240
; Package libc6, manpages
.
(full text, mbox, link).
Acknowledgement sent to kaih@khms.westfalen.de (Kai Henningsen)
:
Extra info received and forwarded to list. Copy sent to Dale Scheetz <dwarf@polaris.net>, Nicol�s Lichtmaier <nick@feedback.net.ar>
.
(full text, mbox, link).
Message #40 received at 12240@bugs.debian.org (full text, mbox, reply):
ian@chiark.greenend.org.uk (Ian Jackson) wrote on 04.07.98 in <E0ysSIW-0006Qg-00@chiark.greenend.org.uk>:
[...]
> tmpfile() is documented in the glibc info file as:
[...]
Just for reference, the following is the definition for tempfile() from
Unix98:
The Single UNIX « Specification, Version 2
Copyright + 1997 The Open Group
_________________________________________________________________
NAME
tmpfile - create a temporary file
SYNOPSIS
#include <stdio.h>
FILE *tmpfile(void);
DESCRIPTION
The tmpfile() function creates a temporary file and opens a
corresponding stream. The file will automatically be deleted when
all references to the file are closed. The file is opened as in
fopen() for update (w+).
The largest value that can be represented correctly in an object of
type off_t will be established as the offset maximum in the open
file description.
If the process is killed in the period between file creation and
unlinking, a permanent file may be left behind.
An error message may be written to standard error if the stream
cannot be opened.
RETURN VALUE
Upon successful completion, tmpfile() returns a pointer to the
stream of the file that is created. Otherwise, it returns a null
pointer and sets errno to indicate the error.
ERRORS
The tmpfile() function will fail if:
[EINTR]
A signal was caught during tmpfile().
[EMFILE]
{OPEN_MAX} file descriptors are currently open in the calling
process.
[ENFILE]
The maximum allowable number of files is currently open in the
system.
[ENOSPC]
The directory or file system which would contain the new file
cannot be expanded.
[EOVERFLOW]
The file is a regular file and the size of the file cannot be
represented correctly in an object of type off_t.
The tmpfile() function may fail if:
[EMFILE]
{FOPEN_MAX} streams are currently open in the calling process.
[ENOMEM]
Insufficient storage space is available.
EXAMPLES
None.
APPLICATION USAGE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
fopen(), tmpnam(), unlink(), <stdio.h>.
_________________________________________________________________
UNIX « is a registered Trademark of The Open Group.
Copyright + 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]
_________________________________________________________________
MfG Kai
Information forwarded to debian-bugs-dist@lists.debian.org, Dale Scheetz <dwarf@polaris.net>, Nicol�s Lichtmaier <nick@feedback.net.ar>
:
Bug#12240
; Package libc6, manpages
.
(full text, mbox, link).
Acknowledgement sent to Topi Miettinen <Topi.Miettinen@medialab.sonera.net>
:
Extra info received and forwarded to list. Copy sent to Dale Scheetz <dwarf@polaris.net>, Nicol�s Lichtmaier <nick@feedback.net.ar>
.
(full text, mbox, link).
Message #45 received at 12240@bugs.debian.org (full text, mbox, reply):
There are two parts in the patch, one for tmpfile() use and other for
tmpnam().
Regarding tmpfile(), I checked K&R, Stevens, Donald Lewine's "POSIX
Programmer's Guide", and Solaris manual page and they all agree with glibc
documentation in that nothing is guaranteed. Fixing this in glibc is
trivial, by changing fifth argument of __stdio_gen_tempname call from 0 to
1 in stdio-common/tmpfile.c. This will cause security problems with setuid
programs using tmpfile(), though. If glibc is fixed, the first part of the
patch affecting build.c could be ignored, but I fail to see other than
aesthetical problems with the patch.
However, tmpnam() is different, it is specified to use only L_tmpnam bytes
of user-specified buffer. Fixing glibc would therefore be non-trivial,
maybe like only using TMPDIR if the whole string would fit in L_tmpnam
bytes. Currently, this is defined as 19, so if TMPDIR=/home/abcdefgh/tmp,
it wouldn't ever be used by programs compiled today. The second part of the
patch affecting info.c changes tmpnam() to tempnam(), which is specified to
allow the user to override the system path. I think this part should be
applied.
-Topi
Information forwarded to debian-bugs-dist@lists.debian.org, Ben Collins <bcollins@debian.org>, Nicol�s Lichtmaier <nick@debian.org>
:
Bug#12240
; Package libc6, manpages
.
(full text, mbox, link).
Acknowledgement sent to "���J"<usakid@usa.net>
:
Extra info received and forwarded to list. Copy sent to Ben Collins <bcollins@debian.org>, Nicol�s Lichtmaier <nick@debian.org>
.
(full text, mbox, link).
Message #50 received at 12240@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/html, inline)]
Information forwarded to debian-bugs-dist@lists.debian.org, Ben Collins <bcollins@debian.org>, Nicol�s Lichtmaier <nick@debian.org>
:
Bug#12240
; Package libc6, manpages
.
(full text, mbox, link).
Acknowledgement sent to ansell168@hongkong.com
:
Extra info received and forwarded to list. Copy sent to Ben Collins <bcollins@debian.org>, Nicol�s Lichtmaier <nick@debian.org>
.
(full text, mbox, link).
Message #55 received at 12240@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/html, inline)]
Information forwarded to debian-bugs-dist@lists.debian.org, Ben Collins <bcollins@debian.org>, Martin Schulze <joey@debian.org>, glibc@packages.qa.debian.org, manpages@packages.qa.debian.org
:
Bug#12240
; Package libc6, manpages
.
(full text, mbox, link).
Acknowledgement sent to <latest@yahoo.com>
:
Extra info received and forwarded to list. Copy sent to Ben Collins <bcollins@debian.org>, Martin Schulze <joey@debian.org>, glibc@packages.qa.debian.org, manpages@packages.qa.debian.org
.
(full text, mbox, link).
Message #60 received at 12240@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
FREE FREE FREE FREE FREE FREE FREE FREE FREE
FOR AOL MEMBERS ALSO
THE GREATEST WEB SITE EVER
FREE PSYCHIC READING
Please go to:
http://66.231.65.36/olp/
Please cut and paste this link into your AOL, or internet browser
STILL NOT SURE? READ BELOW.....
Do you need answers about life's important questions?
Questions about love, romance, your spouse?
Is love, romance, and passion in your future?
Questions about money, finances, your career or job?
Questions about family matters and life in general?
We have the answers! Please go to: http://66.231.65.36/olp/
Please cut and paste this link into your AOL browser
Is your spouse cheating or thinking about cheating?
Is now the time to ask that special someone out on a date?
Is your current relationship going to get better or worse?
When should you ask your boss for a raise or a promotion?
Looking for lucky lottery numbers to win big this week?
We have the answers! Please go to: http://66.231.65.36/olp/
Please cut and paste this link into your AOLbrowser
Our master psychics have harnessed the power of the internet
to give the most astounding and accurate psychic readings
for over 4-years now - and we have become the world's leading
online psychic service. Visit us today and you can get a free
horoscope and you can test your psychic ability for free!
Finally, incredible psychic readings available in private over
the internet. Visit us 24 hours a day, 7-days a week, to find
out the answers you need to know to get the most out of your
life -starting right now! Click here now to find out more
about our master psychic services.
Please go to: http://66.231.65.36/olp/
Please cut and paste this link into your AOLbrowser
To be removed please go to: http://66.231.65.36/olp/cleanlist.html
Reply sent to Jeff Bailey <jbailey@nisa.net>
:
You have taken responsibility.
(full text, mbox, link).
Notification sent to "Mark W. Eichin" <eichin@kitten.gen.ma.us>
:
Bug acknowledged by developer.
(full text, mbox, link).
Message #65 received at 12240-done@bugs.debian.org (full text, mbox, reply):
This bug was fixed in December of 1998. Please reopen if you have any
further troubles.
Tks,
Jeff Bailey
--
learning from failures is nice in theory...
but in practice, it sucks :)
- Wolfgang Jaehrling
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Fri Apr 26 04:53:19 2024;
Machine Name:
buxtehude
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.