tech-userlevel archive

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

Re: find and limits



    Date:        Sat, 6 Apr 2019 08:30:26 +0000
    From:        coypu%sdf.org@localhost
    Message-ID:  <20190406083025.GA22952%SDF.ORG@localhost>

  | The command failing is, for urbanrenewal-ttf,

I found the sources for install (xinstall!) and I think I
understand what happens now...

	/* pseudo-code ... obviously */
	size = stat(filename).st_size;
	from = open(filename, "r");
	to = open(filename, "w" + "trunc");

	p = mmap(NULL, size, READ, SHARED, from);
	write(to, p, size);
	perror("write");

The truncate on the dest (which is the same file as the source)
makes the file size 0, but we already know how big it was, and
mmap() and write() the original size.   When the write attempts
to access file data that doesn't exist, it apparently makes EINVAL
(I'd have expected EFAULT, but nevermind).

Using the -r option to install would (should) also have worked,
but that would still (potentially) install everything twice.

All this is somewhat non-deterministic, as it depends upon the
order in which find traverses the tree - if it found the .destdir
before the original ttf files, there would have been none in there
yet, and all would have been fine (seemingly fine).   That's
unlikely though just because of the order in which things are
created.

kre




Home | Main Index | Thread Index | Old Index