dskvr / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

incorrect removal of orphaned file during upgrade when file has moved to dependent package #50

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create package a version 1, containing file /foo.
2. Create package a version 2, without file /foo, depending on package b.
3. Create package b version 1, containing file /foo.
4. Create package repository containing a_2 and b_1.
5. Install a_1 manually.
6. opkg update; opkg upgrade

(The attached test ipk files have different architectures and the file /foo is 
a conffile, but the issue is expected regardless of these constraints.)

What is the expected output? What do you see instead?

File /foo is expected to exist and be provided by package b_1. This is not the 
case, file /foo has disappeared.

opkg_remove.c: remove_data_files_and_list() should double check that the file 
belongs to the package before removing it.

Original issue reported on code.google.com by graham.g...@gmail.com on 8 Jun 2010 at 12:52

Attachments:

GoogleCodeExporter commented 8 years ago
Initial bug report from Martin Jansa:
http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg06713.h
tml
http://groups.google.com/group/opkg-devel/browse_thread/thread/114c8c18a290498b

Should be fixed with r531.

Original comment by graham.g...@gmail.com on 8 Jun 2010 at 1:09

GoogleCodeExporter commented 8 years ago
ANG root@zjama ~ $ opkg upgrade
Downloading http://jama.home.net/org.openembedded.dev/spitz/Packages.gz.
Inflating http://jama.home.net/org.openembedded.dev/spitz/Packages.gz.
Updated list of available packages in /var/lib/opkg/spitz.
ANG root@zjama ~ $ opkg install a
Installing a (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/a_1_armv4t.ipk.
Configuring a.
ANG root@zjama ~ $ file /foo
/foo: ASCII text

=== THIS is OK ===
=== added a_2 and b_1 to spitz directory and regenerated index
ANG root@zjama ~ $ opkg update; opkg upgrade
Downloading http://jama.home.net/org.openembedded.dev/spitz/Packages.gz.
Inflating http://jama.home.net/org.openembedded.dev/spitz/Packages.gz.
Updated list of available packages in /var/lib/opkg/spitz.
Upgrading a on root from 1 to 2...
Downloading http://jama.home.net/org.openembedded.dev/spitz/a_2_armv4t.ipk.
Installing b (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Not deleting modified conffile /foo.
Configuring b.
Configuring a.
Collected errors:
 * file_md5sum_alloc: Failed to open file /foo: No such file or directory.
ANG root@zjama ~ $ ls /foo
ls: cannot access /foo: No such file or directory

=== THIS is BAD, where is /foo :/ ===

ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:
ANG root@zjama ~ $ opkg files a
Package a (2) is installed on root and has the following files:
ANG root@zjama ~ $ opkg install -force-reinstall b
Reinstalling b (1) on root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:

=== still shows nothing... but! ===
ANG root@zjama ~ $ ls /foo
/foo
=== where did I get /foo now? ===
ANG root@zjama ~ $ opkg search /foo
ANG root@zjama ~ $ opkg remove b
Collected errors:
 * print_dependents_warning: Package b is depended upon by packages:
 * print_dependents_warning:    a
 * print_dependents_warning: These might cease to work if package b is removed.

 * print_dependents_warning: Force removal of this package with --force-depends.
 * print_dependents_warning: Force removal of this package and its dependents
 * print_dependents_warning: with --force-removal-of-dependent-packages.
ANG root@zjama ~ $ opkg remove b -force-depends
Removing package b from root...

ANG root@zjama ~ $ ls /foo
/foo
=== Hmm it's still there ===
ANG root@zjama ~ $ opkg install b
Installing b (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:
/foo
=== Hmm now it claims /foo ownership ===
ANG root@zjama ~ $ ls /foo
/foo
=== Replace b_1_armv4t.ipk (containing only /foo with ipk file with same 
version but with /foo as well as /bar) and regenerate index ===
ANG root@zjama ~ $ ls /foo
/foo
ANG root@zjama ~ $ opkg update
Downloading http://jama.home.net/org.openembedded.dev/spitz/Packages.gz.
Inflating http://jama.home.net/org.openembedded.dev/spitz/Packages.gz.
Updated list of available packages in /var/lib/opkg/spitz.
ANG root@zjama ~ $ opkg install -force-reinstall b
Reinstalling b (1) on root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
ANG root@zjama ~ $ ls /bar
/bar
ANG root@zjama ~ $ ls /foo
/foo
ANG root@zjama ~ $ opkg search /bar
ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:
/foo
ANG root@zjama ~ $ opkg remove -force-depends b
Removing package b from root...
ANG root@zjama ~ $ opkg install b
^CInterrupted. Writing out status database.
ANG root@zjama ~ $ ls /bar
/bar
=== shouldn't be here ===
ANG root@zjama ~ $ ls /foo
ls: cannot access /foo: No such file or directory
=== was removed ok ===
ANG root@zjama ~ $ opkg install b
Installing b (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:
/foo
/bar
ANG root@zjama ~ $ ls /foo
/foo
ANG root@zjama ~ $ ls /bar
/bar
=== Now everything OK again ===

I'll attach both my b_1_armv4t.

Original comment by Martin.J...@gmail.com on 9 Jun 2010 at 3:29

GoogleCodeExporter commented 8 years ago
Test case for strange -force-reinstall behavior, maybe related to r531 change.

Original comment by Martin.J...@gmail.com on 9 Jun 2010 at 3:32

Attachments:

GoogleCodeExporter commented 8 years ago
Hmm... r531 only fixed this in offline root mode. Not sure why the behaviour is 
different without -o.

Original comment by graham.g...@gmail.com on 10 Jun 2010 at 6:26

GoogleCodeExporter commented 8 years ago
I've fixed the behaviour inside an offline root with r532, r533 and r534. r534 
now shows the same bug with and without an offline root.

r536 fixes the test case. Tested both with and without an offline root.

Original comment by graham.g...@gmail.com on 11 Jun 2010 at 2:17

GoogleCodeExporter commented 8 years ago
Thanks looks much better now.
There is still minor issue with claiming ownership of new files during "install 
-force-reinstall" see my log:

ANG root@zjama ~ $ opkg remove a b
Removing package a from root...
Removing package b from root...
ANG root@zjama ~ $ ls /foo
ls: cannot access /foo: No such file or directory
ANG root@zjama ~ $ ls /bar
ls: cannot access /bar: No such file or directory
ANG root@zjama ~ $ opkg update; opkg install a
...Updated list of available packages in /var/lib/opkg/spitz.
Installing a (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/a_1_armv4t.ipk.
Configuring a.
ANG root@zjama ~ $ opkg files a
Package a (1) is installed on root and has the following files:
/foo
ANG root@zjama ~ $ ls -l /foo /bar
ls: cannot access /bar: No such file or directory
-rw-r--r-- 1 1005 1005 4 Jun  8 00:38 /foo
ANG root@zjama ~ $ opkg update; opkg upgrade
...Updated list of available packages in /var/lib/opkg/spitz.
Upgrading a on root from 1 to 2...
Downloading http://jama.home.net/org.openembedded.dev/spitz/a_2_armv4t.ipk.
Installing b (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
Configuring a.
ANG root@zjama ~ $ opkg files a
Package a (2) is installed on root and has the following files:
ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:
/foo
ANG root@zjama ~ $ ls -l /foo /bar
ls: cannot access /bar: No such file or directory
-rw-r--r-- 1 1026 1026 4 Jun  8 00:38 /foo
=== GOOD ===
=== replace b_1 in feed with version containing /foo and /bar ==
ANG root@zjama ~ $ opkg update; opkg install -force-reinstall b
...Updated list of available packages in /var/lib/opkg/spitz.
Reinstalling b (1) on root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
ANG root@zjama ~ $ opkg files a
Package a (2) is installed on root and has the following files:
ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:
/foo
=== reinstalling b didn't claim /bar ownership, but installed it just fine ===
ANG root@zjama ~ $ ls -l /foo /bar
-rw-r--r-- 1 1026 1026 0 Jun  9 15:22 /bar
-rw-r--r-- 1 1026 1026 4 Jun  8 00:38 /foo
=== remove&install to reclaim it ===
ANG root@zjama ~ $ opkg remove b -force-depends
Removing package b from root...
ANG root@zjama ~ $ opkg install b
Installing b (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
ANG root@zjama ~ $ opkg files b
Package b (1) is installed on root and has the following files:
/foo
/bar
ANG root@zjama ~ $ ls -l /foo /bar
-rw-r--r-- 1 1026 1026 0 Jun  9 15:22 /bar
-rw-r--r-- 1 1026 1026 4 Jun  8 00:38 /foo

=== one more test for conffiles feature ===
opkg remove a b
restore feed to have only a_1
ANG root@zjama ~ $ ls -l /foo /bar
ls: cannot access /foo: No such file or directory
ls: cannot access /bar: No such file or directory
opkg update; opkg install a
ANG root@zjama ~ $ cat /foo
foo
ANG root@zjama ~ $ echo my-foo > /foo
ANG root@zjama ~ $ opkg install a -force-reinstall
Reinstalling a (1) on root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/a_1_armv4t.ipk.
Configuring a.
Collected errors:
 * resolve_conffiles: Existing conffile /foo is different from the conffile in the new package. The new conffile will be placed at /foo-opkg.
ANG root@zjama ~ $ cat /foo
my-foo
ANG root@zjama ~ $ cat /foo-opkg
foo
=== GOOD conffiles still work ===
=== add a_2 b_1 to feed ===
ANG root@zjama ~ $ opkg update; opkg upgrade
...Updated list of available packages in /var/lib/opkg/spitz.
Upgrading a on root from 1 to 2...
Downloading http://jama.home.net/org.openembedded.dev/spitz/a_2_armv4t.ipk.
Installing b (1) to root...
Downloading http://jama.home.net/org.openembedded.dev/spitz/b_1_armv4t.ipk.
Configuring b.
Configuring a.
Collected errors:
 * resolve_conffiles: Existing conffile /foo is different from the conffile in the new package. The new conffile will be placed at /foo-opkg.
ANG root@zjama ~ $ cat /foo
my-foo
=== GREAT! my-foo is safe even when file owner is changed from a_1 to b_1, 
please note that in this example I didn't use attached b_1_armv4t.ipk.with.foo, 
because it doesn't have conffile ===

Original comment by Martin.J...@gmail.com on 11 Jun 2010 at 9:10

GoogleCodeExporter commented 8 years ago
The --force-reinstall problem appears to be a separate bug. I've opened this as 
Issue #51.

Original comment by graham.g...@gmail.com on 18 Jun 2010 at 1:24