Project

General

Profile

Bug #9711

fts(3C) needs to be largefile aware

Added by Robert Mustacchi over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
lib - userland libraries
Start date:
2018-08-07
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

illumos imported BSD fts(3) last year, but it was not made largefile aware. This means any 32-bit binaries compiled with _FILE_OFFSET_BITS=64 will break.

This was first reported via pkgsrc GNATS bug 53489 from a user running OpenIndiana, and I also ran into it after my pkgsrc trunk build hosts were upgraded to joyent_20180730T090356Z, as seen in recent bulk builds with a large number of pax failures.

History

#1

Updated by Robert Mustacchi over 1 year ago

  • Subject changed from fts(3C) needs lf64 support to fts(3C) needs to be largefile aware
#2

Updated by Robert Mustacchi over 1 year ago

Jonathan's testing notes:

I tested the proposed fix against all versions of 32-bit, 32-bit largefile, and 64-bit, and confirmed that the patch fixes the 32-bit largefile case while unaffecting the other cases. I performed a full smartos-live build with the change, and mounted the modified 32-bit and 64-bit libc.so.1 as well as fts.h into a joyent_20180730T090356Z chroot.

I used both NetBSD pax (the source of the original bug report) as well as a small test case I wrote while verifying this bug.

#include <sys/types.h>
#include <sys/stat.h>
#include <fts.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static FTS *ftsp = NULL;
static FTSENT *ftent = NULL;
static int ftsopts = 0;

int
main()
{
    char *patharr[2];

    patharr[0] = strdup("/var/tmp");
    patharr[1] = NULL;

    if ((ftsp = fts_open(patharr, ftsopts, NULL)) == NULL) {
        perror("fts_open");
        exit(1);
    }

    for (;;) {
        if ((ftent = fts_read(ftsp)) == NULL)
            break;

        printf("%s = %d\n", ftent->fts_name, ftent->fts_info);
    }
}
#3

Updated by Electric Monk over 1 year ago

  • Status changed from New to Closed
  • % Done changed from 90 to 100

git commit db132910a923e71326bd3fde5c15548dabd000b9

commit  db132910a923e71326bd3fde5c15548dabd000b9
Author: Jonathan Perkin <jperkin@joyent.com>
Date:   2018-08-10T22:13:55.000Z

    9711 fts(3C) needs to be largefile aware
    Reviewed by: Yuri Pankov <yuripv@yuripv.net>
    Reviewed by: Jason King <jason.king@joyent.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Also available in: Atom PDF