[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tar fails with 256



John Smith wrote:

> > > All I really want to know is what error 256 meant, If I have time to
> >list
> > > them all I will.
Use the source and man pages.
First figure out where the source is
> whereis pkg_create
/usr/sbin/pkg_create

That means that the source will be in /usr/src/usr.sbin/pkg_*
> cd /usr/src/usr.sbin/pkg_install/create

Look for the error message
>grep failed *.c
main.c:     warnx("package creation failed");
perform.c:      err(2, "failed to fork");
perform.c:      err(2, "failed to execute tar command");
perform.c:      errx(2, "tar command failed with code %d", ret);

>vi perform.c
A few seconds of observation shows that pkg_create calls wait(&ret) and
if it is non zero emits the error message.

> man 2 wait

The value in ret IS NOT THE EXIT VALUE, you use a macro,
WEXITSTATUS(ret), to get the return value. WEXITSTATUS is defined in
/usr/include/sys/wait.h
#define WEXITSTATUS(x)       (_W_INT(x) >> 8)

from man tar:
ERRORS
     tar will exit with one of the following values:

     0   All files were processed successfully.

     1   An error occurred.

So tar returned a 1 and pkg_create printed out the value returned by
wait (256).
Your 256 is a 1.

Which means, that you have to read the error messages emitted by tar to
know what is going on.  Which is what others tried to tell you.

It took less time to look this up than it took you to write the first
email. On any mailing list you should invest at least half an hour of
your own time researching and preparing any email that thousands of
people will read.

BTW, shouldn't pkg_create use
  errx(2, "tar command failed with code %d", WEXITSTATUS(ret));
instead of
  errx(2, "tar command failed with code %d", ret);

joe