Hi Santiago, Quoting Santiago Vila (2021-09-24 12:25:27) > Is DPKG_ROOT always supposed to have a trailing slash?
no. In fact, during normal operation (without --force-script-chrootless), DPKG_ROOT is not "/" but "" and thus does not have a trailing slash. And even with --force-script-chrootless, the path is *not* guaranteed to have a trailing slash. > I guess it would be more robust by not assuming such thing, in which case I > don't understand why I see things like "$DPKG_ROOT$1" in the patch. (Or maybe > there is something I'm missing). The patch places DPKG_ROOT in front of other variables without a slash between them in the following places: 1. in front of the second argument to change_owner(). The function gets called by: * ensure_file_owner_mode() which in turn is only used with arguments that have a preceding slash * install_local_dir() which in turn is only used with arguments that have a preceding slash * install_directory() which explicitly adds a preceding slash 2. in front of the second argument to change_mode() --- same as above 3. in front of the first argument to ensure_file_owner_mode() which only gets called with arguments that have a preceding slash 4. in front of the first argument to install_local_dir() which only gets called with arguments that have a preceding slash 5. in front of the second argument to install_from_default() which gets called four times with arguments that have a preceding slash 6. in front of the first argument to migrate_directory() which gets called twice with arguments that have a preceding slash 7. in front of the second argument to update_to_current_default() which gets called twice with arguments that have a preceding slash Thus, in the way that the involved functions are currently called, not separating $DPKG_ROOT with a slash from the next path is no different from inserting that slash. Is the maintainer script called by other scripts that call the functions with different arguments? Or are you thinking about future additions to the maintainer script that might somehow end up calling the functions above with a relative path instead of an absolute one? If you want to change the current patch, I could: 1. add a slash between $DPKG_ROOT and the next variable -- even if $DPKG_ROOT ends in a slash, multiple slashes don't make a difference 2. add code to the respective functions that ensure that the arguments start with a slash How would you like me to proceed? Thanks! cheers, josch
signature.asc
Description: signature