David Z David Z - 15 days ago 5
R Question

Warning message during building an R package: invalid uid value replaced by that for user 'nobody'

I was building an R package using

R CMD build ABC
and got this warning message:

* building ‘milonga_1.0.tar.gz’
Warning: invalid uid value replaced by that for user 'nobody'

I have no idea what it means. Would somebody have a brief explanation?


I get this all the time. tl;dr you can ignore it, it has to with the problem that tar files can't portably allow user IDs greater than 32767, but user IDs on some systems are greater than this.

Searching the code on Winston Chang's Github mirror of the R source tree finds this code in src/library/utils/R/tar.R:

 uid <- info$uid
 ## uids are supposed to be less than 'nobody' (32767)
 ## but it seems there are broken ones around: PR#15436
 if(!is.null(uid) && !is.na(uid)) {
      if(uid < 0L || uid > 32767L) {invalid_uid <- TRUE; uid <- 32767L}
      header[109:115] <- charToRaw(sprintf("%07o", uid))

(here's a link to the referenced bug report and other discussion on the devtools issue list).

Looking at /etc/passwd on my system shows that I have userid 56347.

bolker:x:56347:1001:Ben Bolker,,,,:/home/bolker:/bin/bash

Wikipedia says

POSIX requires the UID to be an integer type. Most Unix-like operating systems represent the UID as an unsigned integer. The size of UID values varies amongst different systems; some UNIX OS's[which?] used 15-bit values, allowing values up to 32767, while others such as Linux supported 16-bit UIDs, making 65536 unique IDs possible. The majority of modern Unix-like systems have switched to 32-bit UIDs, allowing 4,294,967,296 (232) unique IDs.


For compatibility between 16-bit and 32-bit UIDs, many Linux distributions now set it to be 2^16−2 = 65,534; the Linux kernel defaults to returning this value when a 32-bit UID does not fit into the return value of the 16-bit system calls.[11]

Brian Ripley says

A tarball can only store uids up to 'nobody' (usually 32767), and certainly larger ones cannot be unpacked portably. The warnings did not occur before, but the tarball produced could cause problems when unpacking with other tools.

I can't find much more documentation on this (except that Wikipedia says there are Unix systems with 15-bit uids out there). The GNU tar page appears to give uid as an length-8 character type ...