Bug 988490

Summary: rubygem-psych installation problem after upgrade to f19 from f18
Product: [Fedora] Fedora Reporter: a.thiaville
Component: rubyAssignee: Vít Ondruch <vondruch>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 19CC: alex.ploumistos, amessina, bkabrda, igeorgex, jeremy, mihai, mmorsi, mtasaka, mzdunek, ngaywood, prd-fedora, tagoh, vanmeeuwen+fedora, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: ruby-2.0.0.247-15.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-15 02:40:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
details and workaround none

Description a.thiaville 2013-07-25 17:15:31 UTC
Created attachment 778397 [details]
details and workaround

Description of problem:

Version-Release number of selected component (if applicable): rubygem-psych2.0.0-14.fc19.x86_64
related bug: see https://bugzilla.redhat.com/show_bug.cgi?id=979133#c42 

How reproducible: always 


Steps to Reproduce:
1.upgrade to f19 with fedup. after succes do : 
2. yum -y update. The update of fedora fails with 

Actual results:
  Installation : rubygem-psych-.0.0-124.fc19.x86_64                                                       8/47
Error unpacking rpm package rubygem-psych-2.0.0-14.fc19.x86_64
error: unpacking of archive failed on file /usr/share/ruby/psych: cpio: rename
  
Expected results: yum update ok and so rubygem-psych which is a new dependency
in f19 must be installed.


Additional info :
 see file attachment rubygems-pb-update-from-fc18-to-fc19.txt

Workaround : 
 clean and remove all spurious links (see attachment) in "/usr/share/ruby/psych*"; finally remove directory /usr/share/ruby/psych
 yumdownloader rubygem-psych-2.0.0-14.fc19.x86_64.rpm
 sudo yum localinstall rubygem-psych-2.0.0-14.fc19.x86_64.rpm

Comment 1 Mamoru TASAKA 2013-07-26 01:34:16 UTC
This is because on F-18 (more in precise in ruby-libs-1.9.3.448-31.fc18) /usr/share/ruby/psych is a directory:

http://koji.fedoraproject.org/koji/fileinfo?rpmID=4117091&filename=/usr/share/ruby/psych

but with rubygem-psych-2.0.0-14.fc19 this is a symlink, so rename(2) fails (perhaps with EISDIR) when unpacking rubygem-psych-2.0.0-14.fc19 rpm

rpm (-i or -U) once unpacks a file (directory, etc) to a temporary one in the same directory, like /usr/share/ruby/psych.XXXXXX , then rename(2) the temporary one to the "correct" one. So when rename(2) fails, the temporary files (directory, etc) /usr/share/ruby/psych;51eeef15 is left undeleted.

Possible workaround is
- Leave /usr/share/ruby/psych directory, and create symlinks for all _files_ under /usr/share/ruby/psych pointing to the corresponding ones under /usr/share/gems/gems/psych-2.0.0/lib
  (but this will again create issues when upgrading from rubygem-psych-2.0.0-14.fc19 with ENOTDIR)
- Use %pretrans (not %pre) to force remove the _directory_  /usr/share/ruby/psych if it exists

Comment 2 Mamoru TASAKA 2013-07-26 01:35:35 UTC
ref: bug 447156 comment 22

Comment 3 a.thiaville 2013-07-26 05:08:48 UTC
(In reply to Mamoru TASAKA from comment #1)
> This is because on F-18 (more in precise in ruby-libs-1.9.3.448-31.fc18)
> /usr/share/ruby/psych is a directory:
> 
> http://koji.fedoraproject.org/koji/fileinfo?rpmID=4117091&filename=/usr/
> share/ruby/psych
> 
> but with rubygem-psych-2.0.0-14.fc19 this is a symlink, so rename(2) fails
> (perhaps with EISDIR) when unpacking rubygem-psych-2.0.0-14.fc19 rpm
> 
> rpm (-i or -U) once unpacks a file (directory, etc) to a temporary one in
> the same directory, like /usr/share/ruby/psych.XXXXXX , then rename(2) the
> temporary one to the "correct" one. So when rename(2) fails, the temporary
> files (directory, etc) /usr/share/ruby/psych;51eeef15 is left undeleted.
> 
> Possible workaround is
> - Leave /usr/share/ruby/psych directory, and create symlinks for all _files_
> under /usr/share/ruby/psych pointing to the corresponding ones under
> /usr/share/gems/gems/psych-2.0.0/lib
>   (but this will again create issues when upgrading from
> rubygem-psych-2.0.0-14.fc19 with ENOTDIR)
> - Use %pretrans (not %pre) to force remove the _directory_ 
> /usr/share/ruby/psych if it exists

I don't understand your comment. I already understood that /usr/share/ruby/psych
was a directory in fc18 but why my workaround is not correct ? 
As you say with fc19 /usr/share/ruby/psych is now just a symbolic link and of course there is nothing under it !!! the new package I.e : rpm -qplv rubygem-psych-2.0.0-14.fc19.x86_64.rpm says :
[Alain@alix serviio-1.2.1]$ rpm -qplv rubygem-psych-2.0.0-14.fc19.x86_64.rpm
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/lib64/gems/ruby/psych-2.0.0
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/lib64/gems/ruby/psych-2.0.0/lib
-rwxr-xr-x    1 root    root                    28472 juil. 15 10:34 /usr/lib64/gems/ruby/psych-2.0.0/lib/psych.so
lrwxrwxrwx    1 root    root                       45 juil. 15 10:34 /usr/lib64/ruby/psych.so -> /usr/lib64/gems/ruby/psych-2.0.0/lib/psych.so
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych
-rw-r--r--    1 root    root                    10134 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych.rb
-rw-r--r--    1 root    root                     2068 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/coder.rb
-rw-r--r--    1 root    root                      751 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/core_ext.rb
-rw-r--r--    1 root    root                     2522 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/deprecated.rb
-rw-r--r--    1 root    root                     7188 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/handler.rb
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/handlers
-rw-r--r--    1 root    root                      488 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/handlers/document_stream.rb
-rw-r--r--    1 root    root                      855 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/handlers/recorder.rb
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/json
-rw-r--r--    1 root    root                      458 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/json/ruby_events.rb
-rw-r--r--    1 root    root                      332 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/json/stream.rb
-rw-r--r--    1 root    root                      327 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/json/tree_builder.rb
-rw-r--r--    1 root    root                      749 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/json/yaml_events.rb
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes
-rw-r--r--    1 root    root                     2381 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes.rb
-rw-r--r--    1 root    root                      464 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes/alias.rb
-rw-r--r--    1 root    root                     1795 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes/document.rb
-rw-r--r--    1 root    root                     1516 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes/mapping.rb
-rw-r--r--    1 root    root                     1200 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes/node.rb
-rw-r--r--    1 root    root                     1607 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes/scalar.rb
-rw-r--r--    1 root    root                     2018 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes/sequence.rb
-rw-r--r--    1 root    root                      965 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/nodes/stream.rb
-rw-r--r--    1 root    root                       45 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/omap.rb
-rw-r--r--    1 root    root                     1681 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/parser.rb
-rw-r--r--    1 root    root                     4107 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/scalar_scanner.rb
-rw-r--r--    1 root    root                       44 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/set.rb
-rw-r--r--    1 root    root                      851 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/stream.rb
-rw-r--r--    1 root    root                      483 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/streaming.rb
-rw-r--r--    1 root    root                      553 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/syntax_error.rb
-rw-r--r--    1 root    root                     2104 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/tree_builder.rb
drwxr-xr-x    2 root    root                        0 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors
-rw-r--r--    1 root    root                      206 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors.rb
-rw-r--r--    1 root    root                      596 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors/depth_first.rb
-rw-r--r--    1 root    root                     1452 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors/emitter.rb
-rw-r--r--    1 root    root                      436 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors/json_tree.rb
-rw-r--r--    1 root    root                     9662 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors/to_ruby.rb
-rw-r--r--    1 root    root                      329 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors/visitor.rb
-rw-r--r--    1 root    root                    13847 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/visitors/yaml_tree.rb
-rw-r--r--    1 root    root                      160 juil. 15 10:34 /usr/share/gems/gems/psych-2.0.0/lib/psych/y.rb
-rw-r--r--    1 root    root                     4848 juil. 15 10:34 /usr/share/gems/specifications/psych-2.0.0.gemspec
lrwxrwxrwx    1 root    root                       42 juil. 15 10:34 /usr/share/ruby/psych -> /usr/share/gems/gems/psych-2.0.0/lib/psych
lrwxrwxrwx    1 root    root                       45 juil. 15 10:34 /usr/share/ruby/psych.rb ->  /usr/share/gems/gems/psych-2.0.0/lib/psychch-2.0.0/lib/psych.rb

athe target of this symbolic link /usr/share/ruby/psych:  /usr/share/gems/gems/psych-2.0.0/lib/psych is of course a valid directory and the only correct new path . If there are "missing" files (files which were under /usr/share/ruby/psych and not moved into another package), it would be a very serious bug !!! . I can't test that because i don't know ruby at all ( I prefer python)

Comment 4 Mamoru TASAKA 2013-07-26 06:02:36 UTC
I am saying about how to fix ruby.src.rpm on F-19 and above (to make manual workaround unnecessary), not saying that your manual workaround is incorrect.

Comment 5 Vít Ondruch 2013-07-26 08:45:53 UTC
(In reply to Mamoru TASAKA from comment #1)
Thanks for analysis. I'll take a look what I can do about it.

Comment 6 Vít Ondruch 2013-07-30 12:11:52 UTC
Seems that I'll go with link to %{ruby_vendorlibdir} instead of %{ruby_libdir}, since there is bug 975909 in RPM, which makes %pretrans unusable.

BTW1 This bug affect only people upgrading from F18 and older releases to F19+. 

BTW2 One of workarounds could be to uninstall/install Ruby. That seems more sensible then deleting something on filesystem, although it removes also all packages depending on Ruby.

Comment 7 Vít Ondruch 2013-07-30 14:38:14 UTC
Here is test build available: http://koji.fedoraproject.org/koji/taskinfo?taskID=5678866

Comment 8 Fedora Update System 2013-07-31 12:34:02 UTC
ruby-2.0.0.247-15.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/ruby-2.0.0.247-15.fc19

Comment 9 Fedora Update System 2013-08-02 03:44:43 UTC
Package ruby-2.0.0.247-15.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ruby-2.0.0.247-15.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-14025/ruby-2.0.0.247-15.fc19
then log in and leave karma (feedback).

Comment 10 Marek Zdunek 2013-08-02 17:41:40 UTC
My first problem after upgrading to fc18

rubygems-2.0.5-100.fc19.noarch posiada brakujące wymagania rubygem(psych) >= ('0', '2.0.0', None)

rubygem-psych is already installed

Comment 11 Mamoru TASAKA 2013-08-06 05:14:16 UTC
(In reply to Marek Zdunek from comment #10)
> My first problem after upgrading to fc18
> 
> rubygems-2.0.5-100.fc19.noarch posiada brakujące wymagania rubygem(psych) >=
> ('0', '2.0.0', None)
> 
> rubygem-psych is already installed

Would you attach the exact command you tried, and the full log after you typed the command? (if the log is long, please attach it to this bug)

Comment 12 Marek Zdunek 2013-08-12 15:08:27 UTC
sorry there should be .. after upgrading to fc19

so when i execute
su -c "yum distro-sync"
or yum check
thats what i get:

[marek@amd64 ~]$ su -c "yum distro-sync"
Hasło: 
Wczytane wtyczki: auto-update-debuginfo, changelog, fastestmirror, ps, refresh-packagekit, remove-with-leaves
Loading mirror speeds from cached hostfile
 * ...
Rozwiązywanie zależności
--> Wykonywanie sprawdzania transakcji
---> Pakiet scala.noarch 0:2.9.2-2.fc19 zostanie zainstalowana poprzednia wersja
--> Przetwarzanie zależności: osgi(org.scala-ide.scala.library) dla pakietu: scala-2.9.2-2.fc19.noarch
---> Pakiet scala.noarch 0:2.9.2-4.fc18 zostanie usunięty
--> Ukończono rozwiązywanie zależności
Błąd: Pakiet: scala-2.9.2-2.fc19.noarch (fedora)
          Wymaga: osgi(org.scala-ide.scala.library)
          Usuwanie: scala-2.9.2-4.fc18.noarch (installed)
              osgi(org.scala-ide.scala.library) = 2.9.2
          Zainstalowano poprzednią wersję przez: scala-2.9.2-2.fc19.noarch (fedora)
              Nie odnaleziono
 Można spróbować użyć --skip-broken, aby obejść problem
** Odnaleziono 2 wcześniej istniejących problemów bazy danych RPM. Wynik polecenia "yum check":
kde-settings-kdm-19-23.1.fc19.noarch jest duplikatem kde-settings-kdm-19-23.fc19.noarch
rubygems-2.0.5-100.fc19.noarch posiada brakujące wymagania rubygem(psych) >= ('0', '2.0.0', None)
[marek@amd64 ~]$ yum check
Wczytane wtyczki: auto-update-debuginfo, changelog, fastestmirror, ps, refresh-packagekit, remove-with-leaves
kde-settings-kdm-19-23.1.fc19.noarch jest duplikatem kde-settings-kdm-19-23.fc19.noarch
rubygems-2.0.5-100.fc19.noarch posiada brakujące wymagania rubygem(psych) >= ('0', '2.0.0', None)
Błąd: check all

theres also scala problem from rbz975598

Comment 13 Mamoru TASAKA 2013-08-13 15:20:06 UTC
This message usually means that rubygems needs rubygem(psych), but rubygem-psych is not installed, and it is probably because rubygems-psych installation failed due to some reason - and it is probably because of this issue.

Try manually installing rubygem-psych with

# yum install rubygem-psych
or
# yum reinstall rubygems

If the above commands fail, please show the full output.

Comment 14 Mamoru TASAKA 2013-08-13 15:20:50 UTC
(For clarity, I am not speaking about scala issue)

Comment 15 Fedora Update System 2013-08-15 02:40:23 UTC
ruby-2.0.0.247-15.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Mamoru TASAKA 2013-08-19 02:14:28 UTC
*** Bug 996086 has been marked as a duplicate of this bug. ***

Comment 17 Alexander Ploumistos 2015-06-03 07:28:46 UTC
I've hit the same bug after upgrading from f21 to f22 on a system that has been incrementally upgraded from f17:

Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Upgrading   : rubygem-psych-2.0.8-40.fc22.x86_64                                                                                                                                                  1/2 
Error unpacking rpm package rubygem-psych-2.0.8-40.fc22.x86_64
error: unpacking of archive failed on file /usr/share/ruby/psych: cpio: rename
rubygem-psych-2.0.8-40.fc22.x86_64 was supposed to be installed but is not!
  Verifying   : rubygem-psych-2.0.8-40.fc22.x86_64                                                                                                                                                  1/2 
rubygem-psych-2.0.5-29.fc21.x86_64 was supposed to be removed but is not!
  Verifying   : rubygem-psych-2.0.5-29.fc21.x86_64                                                                                                                                                  2/2 

Upgraded:
  rubygem-psych.x86_64 2.0.8-40.fc22                                                                                                                                                                    

Complete!


I had to remove ruby and dependent packages and also delete the /usr/share/ruby/psych/ directory as well as a dead link, /usr/share/ruby/psych;5203fe6f -> /usr/share/gems/gems/psych-2.0.0/lib/psych.

Should this also be reported against dnf?

Comment 18 Vít Ondruch 2015-06-15 12:29:56 UTC
(In reply to Alexander Ploumistos from comment #17)
> I've hit the same bug after upgrading from f21 to f22

Yes, the workaround applied previously was removed in F22, since you could hit it only when directly upgrading from ruby-2.0.0.247-14.fc20 or older. Actually my original note in .spec file says that the workaround could be removed "as soon as F18 is EOLed", which happened quite long time ago.


> I had to remove ruby and dependent packages and also delete the
> /usr/share/ruby/psych/ directory as well as a dead link,
> /usr/share/ruby/psych;5203fe6f -> /usr/share/gems/gems/psych-2.0.0/lib/psych.

This ^^ is interesting bit. You were not supposed to have psych-2.0.0 directory on your system, since you were upgrading psych 2.0.5 -> 2.0.8. But it is hard to tell now where the actual issue happened :/


> Should this also be reported against dnf?

No, definitely not. It seems that the psych-2.0.0 did not have proper directory ownership at some point in history or RPM screwed up something (which might happen in my experience).

Unfortunately, your report does not contain reproducer (which is quite understandable :)), so hard to tell what went wrong. But I hope that your case is just exception. Sorry for that.

Comment 19 Alexander Ploumistos 2015-06-15 13:06:07 UTC
(In reply to Vít Ondruch from comment #18)
> Yes, the workaround applied previously was removed in F22, since you could
> hit it only when directly upgrading from ruby-2.0.0.247-14.fc20 or older.
> Actually my original note in .spec file says that the workaround could be
> removed "as soon as F18 is EOLed", which happened quite long time ago.

So I _should_ have seen this when I upgraded to F19 from F18. I don't recall which was the recommended upgrade method at the time, but I'm pretty sure I didn't encounter this back then.

> Unfortunately, your report does not contain reproducer (which is quite
> understandable :)), so hard to tell what went wrong. But I hope that your
> case is just exception. Sorry for that.

No need for apologies, it just seemed strange, after reading all of the above to hit the same error.

Comment 20 Anthony Messina 2015-06-27 22:56:31 UTC
(In reply to Alexander Ploumistos from comment #17)
> I've hit the same bug after upgrading from f21 to f22 on a system that has
> been incrementally upgraded from f17:
> 
> Running transaction check
> Transaction check succeeded.
> Running transaction test
> Transaction test succeeded.
> Running transaction
>   Upgrading   : rubygem-psych-2.0.8-40.fc22.x86_64                          
> 1/2 
> Error unpacking rpm package rubygem-psych-2.0.8-40.fc22.x86_64
> error: unpacking of archive failed on file /usr/share/ruby/psych: cpio:
> rename
> rubygem-psych-2.0.8-40.fc22.x86_64 was supposed to be installed but is not!
>   Verifying   : rubygem-psych-2.0.8-40.fc22.x86_64                          
> 1/2 
> rubygem-psych-2.0.5-29.fc21.x86_64 was supposed to be removed but is not!
>   Verifying   : rubygem-psych-2.0.5-29.fc21.x86_64                          
> 2/2 
> 
> Upgraded:
>   rubygem-psych.x86_64 2.0.8-40.fc22                                        
> 
> 
> Complete!
> 
> 
> I had to remove ruby and dependent packages and also delete the
> /usr/share/ruby/psych/ directory as well as a dead link,
> /usr/share/ruby/psych;5203fe6f -> /usr/share/gems/gems/psych-2.0.0/lib/psych.
> 
> Should this also be reported against dnf?

I can confirm that Alexander's workaround in comment #17 was necessary and worked for me after a dnf upgrade from f21 to f22.