Bug 1218587 - sysfs files archived with tar contain extra zeroes
Summary: sysfs files archived with tar contain extra zeroes
Status: RESOLVED FEATURE
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Kernel (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: openSUSE Kernel Bugs
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-07 20:37 UTC by Michal Suchanek
Modified: 2024-01-09 15:49 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Suchanek 2024-01-07 20:37:41 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
Comment 1 Takashi Iwai 2024-01-09 15:49:50 UTC
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.