Bug 304167

Summary: Installation of Midnight Commander fails on both factory and beta2
Product: [openSUSE] openSUSE 10.3 Reporter: Forgotten User 5jFyFBvk-I <forgotten_5jFyFBvk-I>
Component: InstallationAssignee: Dirk Mueller <dmueller>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: coolo, matz, nadvornik, pgajdos, suse-beta
Version: Beta 2   
Target Milestone: ---   
Hardware: PC   
OS: openSUSE 10.3   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Forgotten User 5jFyFBvk-I 2007-08-24 07:57:20 UTC
I dont remember the error message.. Sorry, but it is when extracting the message, some kind of linking error I think. cpio!?
Comment 1 Forgotten User 5jFyFBvk-I 2007-08-24 08:22:03 UTC
The error was:
Subprocess failed. Error: RPM failed: error: unpacking of archive failed on file /etc/profile.d/mc.sh;46ceb0f9: cpio: link failed - Invalid cross-device link


---
error: unpacking of archive failed on file /etc/profile.d/mc.sh;46ceb0f8: cpio: link failed - Invalid cross-device link

2007-08-24 12:20:40 mc-4.6.1-122.i586.rpm install failed
rpm output:
error: unpacking of archive failed on file /etc/profile.d/mc.sh;46ceb0f8: cpio: link failed - Invalid cross-device link

2007-08-24 12:20:41 mc-4.6.1-122.i586.rpm install failed
rpm output:
error: unpacking of archive failed on file /etc/profile.d/mc.sh;46ceb0f9: cpio: link failed - Invalid cross-device link

Comment 2 Ladislav Michnovic 2007-08-24 14:22:34 UTC
I am unable to reproduce. Where did you see this message? During installation? 
Can you reproduce it using rpm command in console?
Comment 3 Vladimir Nadvornik 2007-08-24 15:03:18 UTC
It is caused by %fdupes which created a hardlink between configuration file
in /etc and configuration template in /usr. 

mc.spec contains %fdupes $RPM_BUILD_ROOT, I could change it to 
%fdupes $RPM_BUILD_ROOT/usr, but IMHO it should be fixed in the macro.
Comment 4 Christian Boltz 2007-08-25 18:25:21 UTC
What about always using symlinks instead of hardlinks? This would solve the problem.

Sidenote:
In opensuse-packaging, you proposed to use 
    %fdupes $RPM_BUILD_ROOT/usr
    %fdupes $RPM_BUILD_ROOT/srv

I don't think this solves the problem - don't even try to assume that two directories are on the same partiton. 
Example: I have /var/log, /var/lock and /var/run on my / partition, the other directories in /var/ are symlinked to my (encrypted) home partition. (Yes, this might be unusual, but it's a real-world example ;-)
Comment 5 Forgotten User 5jFyFBvk-I 2007-08-27 07:32:24 UTC
I got the error when installing B2, but forgot the errormessage, so I tried again after finalizing the installation using yast2 sw_single, and got the exact same error.
I then manually installed it using rpm -Uvh and got a similar error (not the whole bunch) but now the package is installed I just ignored the error.
Comment 6 Vladimir Nadvornik 2007-08-27 08:57:41 UTC
(In reply to comment #4 from Christian Boltz)
> What about always using symlinks instead of hardlinks? This would solve the
> problem.

Not completely. Neither a symlink from a configuration file in /etc to
a configuration example in /usr nor the other way around does not make really sense.


> I don't think this solves the problem - don't even try to assume that two
> directories are on the same partiton. 

IMHO fdupes makes sense on read-only files, i. e. on /usr. I can't think of
any reason why /usr should not be on single partition.

Linking files in /var, which are empty at the beginning and are supposed
to grow over time is a bug. Thus I would skip directories like /etc and /var
completely.
Comment 7 Ladislav Michnovic 2007-08-27 09:10:36 UTC
(In reply to comment #5 from Jarl Gjessing)
> I got the error when installing B2, but forgot the errormessage, so I tried
> again after finalizing the installation using yast2 sw_single, and got the
> exact same error.
> I then manually installed it using rpm -Uvh and got a similar error (not the
> whole bunch) but now the package is installed I just ignored the error.
> 

How is your hard disk partitioned?  
Comment 8 Vladimir Nadvornik 2007-08-28 15:06:51 UTC
I have fixed it in mc.

Other option for generic fix would be to leave the %fdupes macro as is and
detect possible problems with rpmlint. It would not be limited only to fdupes,
but it could detect all {hard|sym}link problems.
Dirk, what do you think?
Comment 9 Christian Boltz 2007-08-28 15:15:41 UTC
(In reply to comment #6 from Vladimir Nadvornik)
> (In reply to comment #4 from Christian Boltz)
...
> > I don't think this solves the problem - don't even try to assume that two
> > directories are on the same partiton. 
> 
> IMHO fdupes makes sense on read-only files, i. e. on /usr. I can't think of
> any reason why /usr should not be on single partition.

Well, "grown" systems with several small partitions or hard disks might be an example. I don't say these are "usual" systems nowadays, but why should you risk problems by using hardlinks when symlinks do the same job at no risk?
Comment 10 Vladimir Nadvornik 2007-08-29 15:23:50 UTC
OK, my proposal for rpmlint check:

hardlinks across top level directories      - error
hardlinks across directories                - warning
hardlinks between %config files             - error
symlink "config file" -> "non-config file"  - warning

Comment 11 Dirk Mueller 2007-08-30 11:07:05 UTC
I think rpm should handle this more gracefully. otherwise we cannot use hardlinks if its more than one directory, and e.g. glibc-locale already ignores this rule. 
Comment 12 Michael Schröder 2007-08-30 13:58:34 UTC
No, it's a bug in fdupes. it must not link across possible partitions.
(I don't dare to touch that part of rpm.)
Comment 13 Dirk Mueller 2007-08-30 14:26:32 UTC
ok for a generic rpmlint check right now?
Comment 14 Christoph Thiel 2007-08-30 15:05:43 UTC
Let's do it -- but only in BETA first.
Comment 15 Dirk Mueller 2007-08-30 16:50:40 UTC
check added and fatal for BETA. 
Comment 16 Petr Gajdos 2007-09-03 09:43:56 UTC
I have two files with same contents (not hardlinked) in certain package on two partitions and I got hardlink-across-partition. In this case, it is duplicate file that can and will be symlinked. But is it right in every case?
Comment 17 Michael Matz 2007-09-03 16:25:20 UTC
Let me just way in here and say, that I also think that rpm simply needs to
handle this situation.  At least for after 10.3 .