Re: File conflict when upgrading package

2013-11-22 Thread Kevin Kofler
Mattias Ellert wrote:
   os.execute(rm -rf %{_datadir}/applications/%{name}.desktop)

Ewww… Using os.execute in Lua scriptlets is scary because the whole point of 
writing them in Lua rather than shell is to avoid depending on stuff being 
installed on the file system. Now in this case, you'll likely get away with 
it because your scriptlet runs the rm only if the directory existed to begin 
with, which is not the case in the initial installation use case where 
things like rm are unavailable. Still, actually deleting things from within 
Lua would be cleaner (but likely more work to do recursively, sure; it'd 
help if RPM exported some rm_rf or so function to Lua scriptlets).

Kevin Kofler

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-18 Thread Florian Weimer

On 11/18/2013 12:44 AM, Mattias Ellert wrote:

sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:

Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64 
however fails with
Transaction check error:
 file /usr/share/applications/xflr5.desktop from install of 
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
package xflr5-6.09.05-4.fc21.x86_64


You are replacing a directory with an ordinary file. The requires a
%pretrans script. %pretrans scripts must be written in lua:

%pretrans -p lua
st = posix.stat(%{_datadir}/applications/%{name}.desktop)
if st and st.type == directory then
   os.execute(rm -rf %{_datadir}/applications/%{name}.desktop)
end


Wow.  Shouldn't RPM support this out of the box?

--
Florian Weimer / Red Hat Product Security Team
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-18 Thread Panu Matilainen

On 11/18/2013 10:27 AM, Florian Weimer wrote:

On 11/18/2013 12:44 AM, Mattias Ellert wrote:

sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:

Upgrading from xflr5-6.09.05-4.fc21.x86_64 to
xflr5-6.09.05-5.fc21.x86_64 however fails with
Transaction check error:
 file /usr/share/applications/xflr5.desktop from install of
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
package xflr5-6.09.05-4.fc21.x86_64


You are replacing a directory with an ordinary file. The requires a
%pretrans script. %pretrans scripts must be written in lua:

%pretrans -p lua
st = posix.stat(%{_datadir}/applications/%{name}.desktop)
if st and st.type == directory then
   os.execute(rm -rf %{_datadir}/applications/%{name}.desktop)
end


Wow.  Shouldn't RPM support this out of the box?


Should? Sure, it seems like an obvious thing on the surface, but 
replacing directories within a transaction is very complicated due to 
removals happening after installs (and rpm's file fingerprinting semantics).


The new thing here is that rpm = 4.11 detects and reports the 
(unsupported) attempt to replace a directory with something else as a 
conflict, previously it just barfed up with cpio: rename failed - Is a 
directory error in middle of transaction.


An easier-than-pretrans-hack workaround is to just use a different 
filename for the file replacing the directory.


- Panu -
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-18 Thread Sandro Mani


On 18.11.2013 09:48, Panu Matilainen wrote:

On 11/18/2013 10:27 AM, Florian Weimer wrote:

On 11/18/2013 12:44 AM, Mattias Ellert wrote:

sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:

Upgrading from xflr5-6.09.05-4.fc21.x86_64 to
xflr5-6.09.05-5.fc21.x86_64 however fails with
Transaction check error:
 file /usr/share/applications/xflr5.desktop from install of
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
package xflr5-6.09.05-4.fc21.x86_64


You are replacing a directory with an ordinary file. The requires a
%pretrans script. %pretrans scripts must be written in lua:

%pretrans -p lua
st = posix.stat(%{_datadir}/applications/%{name}.desktop)
if st and st.type == directory then
   os.execute(rm -rf %{_datadir}/applications/%{name}.desktop)
end


Wow.  Shouldn't RPM support this out of the box?


Should? Sure, it seems like an obvious thing on the surface, but 
replacing directories within a transaction is very complicated due to 
removals happening after installs (and rpm's file fingerprinting 
semantics).


The new thing here is that rpm = 4.11 detects and reports the 
(unsupported) attempt to replace a directory with something else as a 
conflict, previously it just barfed up with cpio: rename failed - Is 
a directory error in middle of transaction.


An easier-than-pretrans-hack workaround is to just use a different 
filename for the file replacing the directory.


- Panu -

Thank you all.

--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-18 Thread Adam Williamson
On Mon, 2013-11-18 at 00:44 +0100, Mattias Ellert wrote:
 sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:
  Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64 
  however fails with
  Transaction check error:
  file /usr/share/applications/xflr5.desktop from install of 
  xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
  package xflr5-6.09.05-4.fc21.x86_64
 
 You are replacing a directory with an ordinary file. The requires a
 %pretrans script. %pretrans scripts must be written in lua:
 
 %pretrans -p lua
 st = posix.stat(%{_datadir}/applications/%{name}.desktop)
 if st and st.type == directory then
   os.execute(rm -rf %{_datadir}/applications/%{name}.desktop)
 end

We had more or less this conversation a couple of months back in the
context of unbundling webapps. At the time it became clear we really
don't have any best practice for lua snippets for these cases (file -
directory, directory - file). I was hoping someone was gonna come up
with something, but no-one has. I've seen different snippets of vastly
different complexity suggested by different people...
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-18 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Nov 18, 2013 at 01:31:32PM -0800, Adam Williamson wrote:
 On Mon, 2013-11-18 at 00:44 +0100, Mattias Ellert wrote:
  sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:
   Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64 
   however fails with
   Transaction check error:
   file /usr/share/applications/xflr5.desktop from install of 
   xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
   package xflr5-6.09.05-4.fc21.x86_64
  
  You are replacing a directory with an ordinary file. The requires a
  %pretrans script. %pretrans scripts must be written in lua:
  
  %pretrans -p lua
  st = posix.stat(%{_datadir}/applications/%{name}.desktop)
  if st and st.type == directory then
os.execute(rm -rf %{_datadir}/applications/%{name}.desktop)
  end
 
 We had more or less this conversation a couple of months back in the
 context of unbundling webapps. At the time it became clear we really
 don't have any best practice for lua snippets for these cases (file -
 directory, directory - file). I was hoping someone was gonna come up
 with something, but no-one has. I've seen different snippets of vastly
 different complexity suggested by different people...
I think that putting work-arounds for this in multiple packages (where
multiple means more than one), is insane from a software engineering
point-of-view. If rpm has trouble with this case bacause it makes it
hard to implement a transaction, then there's no way that instead
individual packagers are going to implement it in package
scripts. There's just no way that all those snippets are all going to
work correctly, *and* it wastes a *lot* of maintainer time. This must
be fixed in rpm.

Zbyszek
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-17 Thread Reindl Harald


Am 17.11.2013 21:47, schrieb Sandro Mani:
 There was an incorrect desktop-file-install call in a package I maintain, i.e.
 
 |desktop-file-install 
 --dir=%{buildroot}%{_datadir}/applications/%{name}.desktop %{SOURCE1}
 
 which caused the .desktop file to get installed to
 
 /usr/share/applications/%{name}.desktop/%{name}.desktop
 
 I fixed the syntax (by removing the %{name}.desktop part), but now when 
 upgrading the package I get
 |
 
 Transaction check error:
   file /usr/share/applications/xflr5.desktop from install of 
 xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
 package xflr5-6.09.05-4.fc21.x86_64
 
 How can I make the update work smoothly? I tried explicitly specifying 
 Conflicts: xflr5  5.09.05-5, but it did not
 help.

xflr5-6.09.05-4.fc21.x86_64
xflr5-6.09.05-5.fc21.x86_64

why in the world do you specify any conflicts for a ordinary update?



signature.asc
Description: OpenPGP digital signature
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-17 Thread Sandro Mani


On 17.11.2013 22:00, Reindl Harald wrote:


Am 17.11.2013 21:47, schrieb Sandro Mani:

There was an incorrect desktop-file-install call in a package I maintain, i.e.

|desktop-file-install 
--dir=%{buildroot}%{_datadir}/applications/%{name}.desktop %{SOURCE1}

which caused the .desktop file to get installed to

/usr/share/applications/%{name}.desktop/%{name}.desktop

I fixed the syntax (by removing the %{name}.desktop part), but now when 
upgrading the package I get
|

Transaction check error:
   file /usr/share/applications/xflr5.desktop from install of 
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
package xflr5-6.09.05-4.fc21.x86_64

How can I make the update work smoothly? I tried explicitly specifying Conflicts: 
xflr5  5.09.05-5, but it did not
help.

xflr5-6.09.05-4.fc21.x86_64
xflr5-6.09.05-5.fc21.x86_64

why in the world do you specify any conflicts for a ordinary update?

I didn't do it in the package in the repos. It was just something I 
tried locally when trying to find a way to make the update work, since I 
ran out of ideas how to solve it otherwise.

--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-17 Thread Reindl Harald

Am 17.11.2013 22:02, schrieb Sandro Mani:
 On 17.11.2013 22:00, Reindl Harald wrote:

 Am 17.11.2013 21:47, schrieb Sandro Mani:
 There was an incorrect desktop-file-install call in a package I maintain, 
 i.e.

 |desktop-file-install 
 --dir=%{buildroot}%{_datadir}/applications/%{name}.desktop %{SOURCE1}

 which caused the .desktop file to get installed to

 /usr/share/applications/%{name}.desktop/%{name}.desktop

 I fixed the syntax (by removing the %{name}.desktop part), but now when 
 upgrading the package I get
 |

 Transaction check error:
file /usr/share/applications/xflr5.desktop from install of 
 xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
 package xflr5-6.09.05-4.fc21.x86_64

 How can I make the update work smoothly? I tried explicitly specifying 
 Conflicts: xflr5  5.09.05-5, but it did not
 help.
 xflr5-6.09.05-4.fc21.x86_64
 xflr5-6.09.05-5.fc21.x86_64

 why in the world do you specify any conflicts for a ordinary update?

 I didn't do it in the package in the repos. It was just something I tried 
 locally when trying to find a way to make
 the update work, since I ran out of ideas how to solve it otherwise

please describe the *real* problem without hacks



signature.asc
Description: OpenPGP digital signature
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-17 Thread Sandro Mani


On 17.11.2013 22:07, Reindl Harald wrote:

Am 17.11.2013 22:02, schrieb Sandro Mani:

On 17.11.2013 22:00, Reindl Harald wrote:

Am 17.11.2013 21:47, schrieb Sandro Mani:

There was an incorrect desktop-file-install call in a package I maintain, i.e.

|desktop-file-install 
--dir=%{buildroot}%{_datadir}/applications/%{name}.desktop %{SOURCE1}

which caused the .desktop file to get installed to

/usr/share/applications/%{name}.desktop/%{name}.desktop

I fixed the syntax (by removing the %{name}.desktop part), but now when 
upgrading the package I get
|

Transaction check error:
file /usr/share/applications/xflr5.desktop from install of 
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
package xflr5-6.09.05-4.fc21.x86_64

How can I make the update work smoothly? I tried explicitly specifying Conflicts: 
xflr5  5.09.05-5, but it did not
help.

xflr5-6.09.05-4.fc21.x86_64
xflr5-6.09.05-5.fc21.x86_64

why in the world do you specify any conflicts for a ordinary update?


I didn't do it in the package in the repos. It was just something I tried 
locally when trying to find a way to make
the update work, since I ran out of ideas how to solve it otherwise

please describe the *real* problem without hacks


xflr5-6.09.05-4.fc21.x86_64 had an incorrect desktop-file-install call in the 
spec file, namely
desktop-file-install --dir=%{buildroot}%{_datadir}/applications/%{name}.desktop 
%{SOURCE1}
which caused the desktop file to get installed to 
/usr/share/applications/xflr5.desktop/xflr5.desktop

In xflr5-6.09.05-5.fc21.x86_64, I fixed the desktop-file-install call to
desktop-file-install --dir=%{buildroot}%{_datadir}/applications/ %{SOURCE1}
so that the desktop file is correctly installed to
/usr/share/applications/xflr5.desktop

Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64 
however fails with
Transaction check error:
   file /usr/share/applications/xflr5.desktop from install of 
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
package xflr5-6.09.05-4.fc21.x86_64

 


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-17 Thread Reindl Harald

Am 17.11.2013 22:12, schrieb Sandro Mani:
 On 17.11.2013 22:07, Reindl Harald wrote:
 Am 17.11.2013 22:02, schrieb Sandro Mani:
 On 17.11.2013 22:00, Reindl Harald wrote:
 Am 17.11.2013 21:47, schrieb Sandro Mani:
 There was an incorrect desktop-file-install call in a package I maintain, 
 i.e.

 |desktop-file-install 
 --dir=%{buildroot}%{_datadir}/applications/%{name}.desktop %{SOURCE1}

 which caused the .desktop file to get installed to

 /usr/share/applications/%{name}.desktop/%{name}.desktop

 I fixed the syntax (by removing the %{name}.desktop part), but now when 
 upgrading the package I get
 |

 Transaction check error:
 file /usr/share/applications/xflr5.desktop from install of 
 xflr5-6.09.05-5.fc21.x86_64 conflicts with file
 from
 package xflr5-6.09.05-4.fc21.x86_64

 How can I make the update work smoothly? I tried explicitly specifying 
 Conflicts: xflr5  5.09.05-5, but it
 did not
 help.
 xflr5-6.09.05-4.fc21.x86_64
 xflr5-6.09.05-5.fc21.x86_64

 why in the world do you specify any conflicts for a ordinary update?

 I didn't do it in the package in the repos. It was just something I tried 
 locally when trying to find a way to make
 the update work, since I ran out of ideas how to solve it otherwise
 please describe the *real* problem without hacks

 xflr5-6.09.05-4.fc21.x86_64 had an incorrect desktop-file-install call in the 
 spec file, namely
 desktop-file-install 
 --dir=%{buildroot}%{_datadir}/applications/%{name}.desktop %{SOURCE1}
 which caused the desktop file to get installed to 
 /usr/share/applications/xflr5.desktop/xflr5.desktop
 
 In xflr5-6.09.05-5.fc21.x86_64, I fixed the desktop-file-install call to
 desktop-file-install --dir=%{buildroot}%{_datadir}/applications/ %{SOURCE1}
 so that the desktop file is correctly installed to
 /usr/share/applications/xflr5.desktop
 
 Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64 
 however fails with
 Transaction check error:
file /usr/share/applications/xflr5.desktop from install of 
 xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
 package xflr5-6.09.05-4.fc21.x86_64

can you please provide both SPEC files

i still do not get why there can be any conflict
this is not a common behavior in changed %files section for whatever reason
no longer listed files are supposed to be removed without any noise



signature.asc
Description: OpenPGP digital signature
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-17 Thread Sandro Mani


On 17.11.2013 22:18, Reindl Harald wrote:

Am 17.11.2013 22:12, schrieb Sandro Mani:

On 17.11.2013 22:07, Reindl Harald wrote:

Am 17.11.2013 22:02, schrieb Sandro Mani:

On 17.11.2013 22:00, Reindl Harald wrote:

Am 17.11.2013 21:47, schrieb Sandro Mani:

There was an incorrect desktop-file-install call in a package I maintain, i.e.

|desktop-file-install 
--dir=%{buildroot}%{_datadir}/applications/%{name}.desktop %{SOURCE1}

which caused the .desktop file to get installed to

/usr/share/applications/%{name}.desktop/%{name}.desktop

I fixed the syntax (by removing the %{name}.desktop part), but now when 
upgrading the package I get
|

Transaction check error:
 file /usr/share/applications/xflr5.desktop from install of 
xflr5-6.09.05-5.fc21.x86_64 conflicts with file
from
package xflr5-6.09.05-4.fc21.x86_64

How can I make the update work smoothly? I tried explicitly specifying Conflicts: 
xflr5  5.09.05-5, but it
did not
help.

xflr5-6.09.05-4.fc21.x86_64
xflr5-6.09.05-5.fc21.x86_64

why in the world do you specify any conflicts for a ordinary update?


I didn't do it in the package in the repos. It was just something I tried 
locally when trying to find a way to make
the update work, since I ran out of ideas how to solve it otherwise

please describe the *real* problem without hacks


xflr5-6.09.05-4.fc21.x86_64 had an incorrect desktop-file-install call in the 
spec file, namely
desktop-file-install --dir=%{buildroot}%{_datadir}/applications/%{name}.desktop 
%{SOURCE1}
which caused the desktop file to get installed to 
/usr/share/applications/xflr5.desktop/xflr5.desktop

In xflr5-6.09.05-5.fc21.x86_64, I fixed the desktop-file-install call to
desktop-file-install --dir=%{buildroot}%{_datadir}/applications/ %{SOURCE1}
so that the desktop file is correctly installed to
/usr/share/applications/xflr5.desktop

Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64 
however fails with
Transaction check error:
file /usr/share/applications/xflr5.desktop from install of 
xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
package xflr5-6.09.05-4.fc21.x86_64

can you please provide both SPEC files

i still do not get why there can be any conflict
this is not a common behavior in changed %files section for whatever reason
no longer listed files are supposed to be removed without any noise


-4 spec file: 
http://pkgs.fedoraproject.org/cgit/xflr5.git/tree/xflr5.spec?id=510af4da0c081c0b70ec03a35d8878053e5e87d0

-5 spec file: http://pkgs.fedoraproject.org/cgit/xflr5.git/tree/xflr5.spec

I guess this could be an rpm bug, specifically when a directory is 
replaced with a file with the same name when the package is upgraded?


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: File conflict when upgrading package

2013-11-17 Thread Mattias Ellert
sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:
 Upgrading from xflr5-6.09.05-4.fc21.x86_64 to xflr5-6.09.05-5.fc21.x86_64 
 however fails with
 Transaction check error:
 file /usr/share/applications/xflr5.desktop from install of 
 xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
 package xflr5-6.09.05-4.fc21.x86_64

You are replacing a directory with an ordinary file. The requires a
%pretrans script. %pretrans scripts must be written in lua:

%pretrans -p lua
st = posix.stat(%{_datadir}/applications/%{name}.desktop)
if st and st.type == directory then
  os.execute(rm -rf %{_datadir}/applications/%{name}.desktop)
end

Mattias



smime.p7s
Description: S/MIME cryptographic signature
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct