Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 907696 - savedconfig.eclass - don't preserve symlinks
Summary: savedconfig.eclass - don't preserve symlinks
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-02 10:58 UTC by Esteve Varela Colominas
Modified: 2023-08-01 14:18 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log,262.81 KB, text/x-log)
2023-06-02 10:58 UTC, Esteve Varela Colominas
Details
patch (0001-savedconfig.eclass-do-not-preserve-symlink-in-restor.patch,966 bytes, patch)
2023-06-03 01:43 UTC, Mike Gilbert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Esteve Varela Colominas 2023-06-02 10:58:16 UTC
Created attachment 863043 [details]
build log

My /etc/portage/savedconfig/sys-kernel/linux-firmware file is a symlink to a file in /etc/kernel.

When restore_config() copies it, it copies it as a symlink, rather than following the symlink to the linked file. When the ebuild tries to write to it (to generate/save the default config again), this causes a sandbox violation.

I'm not sure if this is the expected behavior, but I think storing savedconfig entries as symlinks makes a lot of sense, and symlinking config files is well-supported across the rest of the portage tree.

 * ACCESS DENIED:  open_wr:       /var/tmp/portage/sys-kernel/linux-firmware-20230515/work/linux-firmware-20230515/linux-firmware.conf
/var/tmp/portage/sys-kernel/linux-firmware-20230515/temp/environment: line 2121: /var/tmp/portage/sys-kernel/linux-firmware-20230515/work/linux-firmware-20230515/linux-firmware.conf: Permission denied
 * ERROR: sys-kernel/linux-firmware-20230515::gentoo failed (install phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line 136:  Called src_install
 *   environment, line 2121:  Called die
 * The specific snippet of code:
 *       echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die;
 * 
 * If you need support, post the output of `emerge --info '=sys-kernel/linux-firmware-20230515::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-kernel/linux-firmware-20230515::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-kernel/linux-firmware-20230515/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-kernel/linux-firmware-20230515/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-kernel/linux-firmware-20230515/image/lib/firmware'
 * S: '/var/tmp/portage/sys-kernel/linux-firmware-20230515/work/linux-firmware-20230515'
 * ----------------------- SANDBOX ACCESS VIOLATION SUMMARY -----------------------
 * LOG FILE: "/var/tmp/portage/sys-kernel/linux-firmware-20230515/temp/sandbox.log"
 * 
VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: open_wr
S: deny
P: /var/tmp/portage/sys-kernel/linux-firmware-20230515/work/linux-firmware-20230515/linux-firmware.conf
A: /var/tmp/portage/sys-kernel/linux-firmware-20230515/work/linux-firmware-20230515/linux-firmware.conf
R: /etc/portage/kernel/modprobed_db/firmwared_6.1.db
C: bash /usr/lib/portage/python3.11/ebuild.sh install 
 * --------------------------------------------------------------------------------
Comment 1 Mike Gilbert gentoo-dev 2023-06-03 01:43:32 UTC
Created attachment 863083 [details, diff]
patch

Give this patch a spin and let me know if it resolves your issue.
Comment 2 Esteve Varela Colominas 2023-06-04 11:53:32 UTC
Sorry for the delay, just tested it and it works flawlessly! Thanks for fixing this!
Comment 3 Esteve Varela Colominas 2023-06-04 11:54:48 UTC
Forgot to add, though, why is -R being removed? Are you sure there's no packages that put directories in savedconfig? I figure only removing -P would be enough.
Comment 4 Mike Gilbert gentoo-dev 2023-06-04 17:28:27 UTC
(In reply to Esteve Varela Colominas from comment #3)

This cp command is only executed when copying a single config file. Directories are handled via the "treecopy" function just below this.
Comment 5 Esteve Varela Colominas 2023-08-01 14:18:05 UTC
completely forgot about this until the bug just hit me again right now.
it works perfectly, so feel free to apply it.