Questions tagged as ['coreutils']
formally GNU Coreutils is a set of basic utilities from text, files and shell utilities. Most of the Unix-like OS contains this package. Question about any of the utilities of the coreutils should use this tag.
Score: 0

realpath API returns error 22(Invalid arg) or 38(function not implemented) on latest Ubuntu 21.04 & other latest linux flavours
sachin@sachin:~$ cat 1.c
#include <limits.h> /* PATH_MAX */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
void main(void) {
char *buf=NULL;
char *res = realpath("./new-CDM/dummy.c", buf);
printf("result = %s",res);
printf("\nerrno = %d\n",errno);
printf("\nBuf = %s\n",buf);
}
sachin@sachin:~$ gcc 1.c
sachin@sachin:~$ ./a.out
result = /hom ...
Score: 0

why is /bin/ls linking to libpthread?
so strange, is ls multi-threaded somehow? what could ls
possibly need libpthread for?
ldd /bin/ls
linux-vdso.so.1 (0x00007ffff7fce000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007ffff7f57000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7d65000)
libpcre2-8.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007ffff7cd2000)
libdl.so.2 => / ...
Score: 6

Head with a weird behavior
I have downloaded a warc file from Common Crawl in Ubuntu 18.04. After decompressing it with gzip, I've tried to get a segment of the file using head
. I first tried:
head -c 29 CC-MAIN-20210620114611-20210620144611-00436.warc
It produced the expected result, outputting the first 29 bytes of the file:
WARC/1.0
WARC-Type: warcinfo
But, if instead of 29, I use 30, it produces a result I was not expecting: ...