Bugzilla – Bug 1218587
sysfs files archived with tar contain extra zeroes
Last modified: 2024-01-09 15:49:50 UTC
tar -cf- /sys/devices/platform/coretemp.0/hwmon/hwmon*/temp1_label | tar -xvf- tar: Removing leading `/' from member names tar: /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_label: File shrank by 4083 bytes; padding with zeros sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_label
I believe this is a nature of sysfs. It reports always 4096 bytes (page size) as the file size, while reading it gives only the actual content. You can see it via "ls -l /sys/devices/platform/coretemp.0/hwmon/hwmon*/temp1_label". tar allocates the buffer from the reported file size, and complains when receiving less contents than that.