Commit Graph

7 Commits

Author SHA1 Message Date
Maxim Cournoyer 61f691fdfb
cpio: Properly handle Unicode characters in file names.
Fixes <https://issues.guix.gnu.org/61722>.

* guix/cpio.scm (file->cpio-header): Compute the file name length in bytes rather than in
characters.
(file->cpio-header*, special-file->cpio-header*): Likewise.
(write-cpio-archive): Likewise, and write the file name as UTF-8 bytes, not
textually, to avoid encoding it as ISO-8859-1.
2023-02-25 14:50:33 -05:00
Tobias Geerinckx-Rice 348f0c61ef
syscalls: Deduplicate device number conversion.
* guix/cpio.scm (device-number, device->major+minor):
Move to, and subsequently import from, …
* guix/build/syscalls.scm (device-number, device-number->major+minor):
…here.  Note the slight name change.
(mounts): Replace 16-bit open code with a DEVICE-NUMBER call.
* gnu/build/linux-boot.scm (device-number):
Remove duplicate 16-bit implementation in favour of the one above.
(resume-if-hibernated): Reuse DEVICE-NUMBER->MAJOR+MINOR.
2021-09-23 18:17:16 +02:00
Tobias Geerinckx-Rice f7e1478202
cpio: Fix device number calculation.
“dev_t in glibc is a 64-bit quantity, with 32-bit major and minor
 numbers.”  — glibc's <bits/sysmacros.h>

The "tests/cpio.scm" was failing because (guix cpio) treated it as a
16-bit quantity instead, leading to header mismatches with the GNU cpio
reference output.

* guix/cpio.scm (device-number, device->major+minor): Use all the bits.
2021-07-04 04:35:35 +02:00
Danny Milosavljevic 8e7c98963f
linux-initrd: Add special-file->cpio-header*.
* guix/cpio.scm (special-file->cpio-header*): New public procedure.
2020-11-22 11:03:31 +01:00
Danny Milosavljevic b1dfc64552
linux-initrd: Handle 'block-special and 'char-special cpio headers as well.
* guix/cpio.scm (make-cpio-header): Handle size correctly for all file types.
(mode->type): Add 'block-special, 'char-special.
2020-11-22 11:02:58 +01:00
Ludovic Courtès eae5b3fff5 linux-initrd: Produce cpio archives with zeroed timestamps, etc.
* guix/cpio.scm (file->cpio-header*): New procedure.
* gnu/build/linux-initrd.scm (write-cpio-archive): Add #:file->header argument
  to 'cpio:write-cpio-archive'.
2015-06-24 18:05:03 +02:00
Ludovic Courtès 7a18c3cc10 Add (guix cpio).
* guix/cpio.scm, tests/cpio.scm: New files.
* Makefile.am (MODULES): Add guix/cpio.scm.
  (SCM_TESTS): Add tests/cpio.scm.
2015-06-24 18:05:03 +02:00