Summary: | emerge silently skips config protected files if a directory has taken it's place | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Jonas Bernoulli <jonas> |
Component: | Core | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | InVCS |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=354893 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 288499 | ||
Attachments: |
patch to create ._cfg file
mergeme() -> stat.S_ISREG() rewrite |
Description
Jonas Bernoulli
2009-06-24 00:11:11 UTC
Created attachment 195614 [details]
patch to create ._cfg file
Thanks, this is in svn r13679. Most of mergeme() is quite messy. But I focus on the 'regular file' part because that is where I want to hook up some of my own code. So have started to refactor that part of the function. I do so to make it easier to actually understand what's going on. So then I noticed other things that seem a strange: A directory is not overwritten with a file even when it is NOT config protected. With my above patch (which you have already applied) the user will at least notice but it still seems wrong: (update from foo-1 to foo-2) foo-1: /etc/foo-config/ /etc/foo-config/foo-config /usr/share/foo/data/ /usr/share/foo/data/part1 /usr/share/foo/data/part2 foo-2: /etc/foo-config /usr/share/foo/data Sure the directory 'foo-config' should be protected but shouldn't this on the other hand just replace the directory 'data' with the file 'data'? So I would change: if stat.S_ISDIR(mydmode): ... elif stat.S_ISREG(mydmode)...: if protected: ... else: overwrite unconditionally to if protected: if stat.S_ISDIR(mydmode): ... elif stat.S_ISREG(mydmode)...: else: overwrite unconditionally I have also attached a patch containing my rewrite of this portion of the code. It can NOT be applied as is, as I first have to make sure that I have not overlooked any hidden behaviour in the old version. My version should behave the same except that: 1. Doesn't protect all directories. See above. 2. No error message is shown when the destination is blocked by a directory. This error message is redundant because it now (see [1]) only affects config protected files) and the user will be informed about the conflicts anyway. Besides this isn't an error, just a special situation. 3. First check if 'mymd5 == md5-of-destination' then if 'mymd5 == saved-md5' not other way around. The only difference this should make is that in very few cases destination is not overwritten by an IDENTICAL file as it would have with the current implementation. So the user sees '---' instead of '>>>' but the end result on the livefs is the same. My version has two 'if condition: pass' but that's a small price when replacing a maximum nesting of 6 with on of 2. Some more problems are mentioned in the comments starting with '???'. Created attachment 197547 [details, diff]
mergeme() -> stat.S_ISREG() rewrite
(In reply to comment #2) > Thanks, this is in svn r13679. Via gitweb: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=abf3368c778c9e615e5fa8acffcb2aa56fdd6a80 This was released in 2.1.7. Please file a new bug for any remaining issues. (In reply to comment #4) > Created an attachment (id=197547) [details] > mergeme() -> stat.S_ISREG() rewrite IIRC I didn't commit this patch because I found a bug in it. If you want, please rebase it against latest git and file a new bug. |