Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
On Fri, 23 Aug 2013, Bastien ROUCARIES wrote: Find -print0 And replacing read by read -r -d $'\0' is safer but I do not know if it is portable. Or xargs but we need to fork for each file and we get the portability problem of find print0. What do you prefer ? find -print0 is fine, dpkg-deb already uses it. read -d is likely a problem however (I believe it's bash specific). I don't think that I have any good answer if we want to support newlines in filenames. But it's probably not an important use case as dpkg itself doesn't cope very well with it. dpkg-deb builds it fine and it installs fine but when you do dpkg -L you get this back (with a single hello\nworld file): $ dpkg -L foo /. /hello /world (This is because the /var/lib/dpkg/info/*.list files are line based) So I would go ahead ignoring this specific problem. Otherwise you could write that specific part in perl but it would be a regression to reintroduce perl in dpkg itself. Cheers, -- Raphaël Hertzog ◈ Debian Developer Discover the Debian Administrator's Handbook: → http://debian-handbook.info/get/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
Too ugly for living (?) but portable: writehex () { printf %b `printf %03o $@` ; } readonebyteinhexzero() { read dummy hex EOF $(dd bs=1 count=1 2 /dev/null | od -t x1) EOF if test x$hex = x ; then return 77; fi if test $(expr length $hex) = 1 ; then hex=0$hex; fi if test x$hex = x00; then printf \n; else printf 0x%s $hex; fi return 0; } (while readonebyteinhexzero; do true; done;) | while IFS=: read path ; do writehex $path; done; On Sat, Aug 24, 2013 at 11:38 AM, Raphael Hertzog hert...@debian.org wrote: On Fri, 23 Aug 2013, Bastien ROUCARIES wrote: Find -print0 And replacing read by read -r -d $'\0' is safer but I do not know if it is portable. Or xargs but we need to fork for each file and we get the portability problem of find print0. What do you prefer ? find -print0 is fine, dpkg-deb already uses it. read -d is likely a problem however (I believe it's bash specific). I don't think that I have any good answer if we want to support newlines in filenames. But it's probably not an important use case as dpkg itself doesn't cope very well with it. dpkg-deb builds it fine and it installs fine but when you do dpkg -L you get this back (with a single hello\nworld file): $ dpkg -L foo /. /hello /world (This is because the /var/lib/dpkg/info/*.list files are line based) So I would go ahead ignoring this specific problem. Otherwise you could write that specific part in perl but it would be a regression to reintroduce perl in dpkg itself. Cheers, -- Raphaël Hertzog ◈ Debian Developer Discover the Debian Administrator's Handbook: → http://debian-handbook.info/get/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
control: clone -1 -2 control: retitle -1 Handle in dpkg-maintscript-helper symlink to dir conversion control: retitle -2 Handle in dpkg-maintscript-helper dir to symlink conversion control: tags -1 - patch control: tags -2 + patch control: tags -2 + confirmed On Sat, Aug 24, 2013 at 12:37 PM, Guillem Jover guil...@debian.org wrote: Hi! On Tue, 2013-08-20 at 21:50:59 +0200, Bastien ROUCARIES wrote: Now that symlink to dir is implemented, how can we implement the reverse operation ? I suppose checking that the: - path is a directory, - if LAST version is lesser Replacing a directory to a symlink is very problematic and has lots of failure modes, replacing a symlink with a directory is trivial in comparison. I'll comment further later today. Could you publish your change to public git tree ? I consider the dir to symlink case as finished so I have cloned the bug, and we could fix it in changelog. Bastien Thanks, Guillem -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
On Sat, Aug 24, 2013 at 11:38 AM, Raphael Hertzog hert...@debian.org wrote: On Fri, 23 Aug 2013, Bastien ROUCARIES wrote: Find -print0 And replacing read by read -r -d $'\0' is safer but I do not know if it is portable. Or xargs but we need to fork for each file and we get the portability problem of find print0. What do you prefer ? find -print0 is fine, dpkg-deb already uses it. read -d is likely a problem however (I believe it's bash specific). I don't think that I have any good answer if we want to support newlines in filenames. But it's probably not an important use case as dpkg itself doesn't cope very well with it. dpkg-deb builds it fine and it installs fine but when you do dpkg -L you get this back (with a single hello\nworld file): $ dpkg -L foo /. /hello /world (This is because the /var/lib/dpkg/info/*.list files are line based) So I would go ahead ignoring this specific problem. Otherwise you could write that specific part in perl but it would be a regression to reintroduce perl in dpkg itself. Could we open a bug report about this ? I have an idea for improving this kind of problem and it will help me. Instead of begining the .list with /. we could begin with /./. and thus encode a .list file version. Bastien Cheers, -- Raphaël Hertzog ◈ Debian Developer Discover the Debian Administrator's Handbook: → http://debian-handbook.info/get/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
On Sat, 2013-08-24 at 22:54:25 +0200, Bastien ROUCARIES wrote: Could we open a bug report about this ? I have an idea for improving this kind of problem and it will help me. Not really, I'd most probably tag it wontfix and close it after a bit. There's so many things in the Debian packaging toolchain that assume no system files contain newlines, that correctly supporting them would break tons of stuff. They could get octal escaped for example (as \NNN), but other stuff might break if it does not unescape these. I think I'll be changing dpkg to reject paths with newlines in them instead. Why would you need system paths to contain newlines anyway? Instead of begining the .list with /. we could begin with /./. and thus encode a .list file version. The infodb already contains a format version file. But I don't really see the point in supporting this. Thanks, Guillem -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
Le 21 août 2013 08:04, Raphael Hertzog hert...@debian.org a écrit : Hi, On Tue, 20 Aug 2013, Bastien ROUCARIES wrote: A possible way to do this could be: * Move the directory away in preinst (dir.dpkg-backup), put in place a symlink pointing to the renamed directory ok this is easy * In postinst, move remaining files from the temporary directory to the directory pointed by the symlink (except if there's already a new file at the expected location, in that case warn about the conflict and leave the file). How can I do this ? mv -n is not portable, and if I use find how to handle symlink ? mymove() { local origin=$1 local target=$2 while read path; do # do the work for each file here done } Not safe if a filename include a new line... Find -print0 And replacing read by read -r -d $'\0' is safer but I do not know if it is portable. Or xargs but we need to fork for each file and we get the portability problem of find print0. What do you prefer ? find $origin | mymove $origin $target You can use compute the relative path names by stripping $origin from the stard and you can do whatever checks you want with test. Should I check if md5sum are the same in case of conflicts and override in this case ? I would not override but it's interesting to compare the files yes. That way we can avoid complaining about a conflict when in fact both files are identical. And we can silently drop our copy. Cheers, -- Raphaël Hertzog ◈ Debian Developer Discover the Debian Administrator's Handbook: → http://debian-handbook.info/get/
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
Le 23 août 2013 20:40, Bastien ROUCARIES roucaries.bast...@gmail.com a écrit : Le 21 août 2013 08:04, Raphael Hertzog hert...@debian.org a écrit : Hi, On Tue, 20 Aug 2013, Bastien ROUCARIES wrote: A possible way to do this could be: * Move the directory away in preinst (dir.dpkg-backup), put in place a symlink pointing to the renamed directory ok this is easy * In postinst, move remaining files from the temporary directory to the directory pointed by the symlink (except if there's already a new file at the expected location, in that case warn about the conflict and leave the file). How can I do this ? mv -n is not portable, and if I use find how to handle symlink ? mymove() { local origin=$1 local target=$2 while read path; do # do the work for each file here done } Not safe if a filename include a new line... Find -print0 And replacing read by read -r -d $'\0' is safer but I do not know if it is portable. Or xargs but we need to fork for each file and we get the portability problem of find print0. What do you prefer ? For find it is not a problem: Find - exec printf %s\0 + And I could test for portability problem of + if needed. And for read I could use in case of problem dd in order to read byte by byte. Bastien find $origin | mymove $origin $target You can use compute the relative path names by stripping $origin from the stard and you can do whatever checks you want with test. Should I check if md5sum are the same in case of conflicts and override in this case ? I would not override but it's interesting to compare the files yes. That way we can avoid complaining about a conflict when in fact both files are identical. And we can silently drop our copy. Cheers, -- Raphaël Hertzog ◈ Debian Developer Discover the Debian Administrator's Handbook: → http://debian-handbook.info/get/
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
Hi, On Tue, 20 Aug 2013, Bastien ROUCARIES wrote: A possible way to do this could be: * Move the directory away in preinst (dir.dpkg-backup), put in place a symlink pointing to the renamed directory ok this is easy * In postinst, move remaining files from the temporary directory to the directory pointed by the symlink (except if there's already a new file at the expected location, in that case warn about the conflict and leave the file). How can I do this ? mv -n is not portable, and if I use find how to handle symlink ? mymove() { local origin=$1 local target=$2 while read path; do # do the work for each file here done } find $origin | mymove $origin $target You can use compute the relative path names by stripping $origin from the stard and you can do whatever checks you want with test. Should I check if md5sum are the same in case of conflicts and override in this case ? I would not override but it's interesting to compare the files yes. That way we can avoid complaining about a conflict when in fact both files are identical. And we can silently drop our copy. Cheers, -- Raphaël Hertzog ◈ Debian Developer Discover the Debian Administrator's Handbook: → http://debian-handbook.info/get/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
-- Forwarded message -- From: Bastien ROUCARIES roucaries.bast...@gmail.com Date: Tue, Aug 20, 2013 at 11:38 PM Subject: Re: Bug#583585: [dpkg] Any news ? To: Raphael Hertzog hert...@debian.org On Tue, Aug 20, 2013 at 10:50 PM, Raphael Hertzog hert...@debian.org wrote: Hi, On Tue, 20 Aug 2013, Bastien ROUCARIES wrote: Now that symlink to dir is implemented, how can we implement the reverse operation ? Note that you still have to update man/dpkg-maintscript-helper.1 AFAIK. We don't want to ship undocumented features. Joined here I suppose checking that the: - path is a directory, - if LAST version is lesser We should clearly define the cases that we want to support (and have it fail when the pre-requisites are not satisfied). You have mutiple questions to answer: 1/ How do you want to handle non-packaged files present in the directory? 2/ How do you want to handle files from other packages in the directory? 3/ What do you do if the expected directory is not a directory? What if it's another symlink (probably setup by the admin)? My first answers would be: 1/ and 2/ try to reinstall those files at their expected place in the directory pointed by the symlink 3/ do nothing A possible way to do this could be: * Move the directory away in preinst (dir.dpkg-backup), put in place a symlink pointing to the renamed directory ok this is easy * In postinst, move remaining files from the temporary directory to the directory pointed by the symlink (except if there's already a new file at the expected location, in that case warn about the conflict and leave the file). How can I do this ? mv -n is not portable, and if I use find how to handle symlink ? Should I check if md5sum are the same in case of conflicts and override in this case ? Note we expect the file unpack to have updated the symlink to a new directory. If it's still pointing to dir.dpkg-backup then we should probably update the symlink ourselves (assuming it's given as parameter to the dpkg-maintscript-helper). ok And what do you means by swap? Could you give some example ? That feature description was written by Lionel Elie Mamane lio...@mamane.lu (in copy). But swapping means something like this: Changing: directory foo, symlink bar (pointing to foo) Into: directory bar, symlink foo (pointing to bar) I'm not sure that this is a frequent case and we should consider whether 2 simultaneous calls to dpkg-maintscript-helper would do the right thing (one symlink2dir associated to one dir2symlink) Cheers, -- Raphaël Hertzog ◈ Debian Developer Discover the Debian Administrator's Handbook: → http://debian-handbook.info/get/ manpatch.diff Description: Binary data
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
On Tue, 2013-08-20 at 23:38:57 +0200, Bastien ROUCARIES wrote: Joined here Thanks, I've squashed the man page update to the local commit, and fixed some issues, like typo and wording stuff, and references to conffiles, and the non-existent package name. Thanks, Guillem -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#583585: Fwd: Bug#583585: [dpkg] Any news ?
On Wed, 2013-08-21 at 00:08:19 +0200, Guillem Jover wrote: On Tue, 2013-08-20 at 23:38:57 +0200, Bastien ROUCARIES wrote: Joined here Thanks, I've squashed the man page update to the local commit, and fixed some issues, like typo and wording stuff, and references to conffiles, and the non-existent package name. Actually, I've fixed the missing package name argument by implementing it on the command. Thanks, Guillem -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org