View Issue Details

IDProjectCategoryView StatusLast Update
0025173LazarusPrinterpublic2013-10-12 16:54
ReporterGregg Moore Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64-linux-gtk 2OSopenSUSE Linux 
Product Version1.0.10 
Summary0025173: Write error: Unable to create file "/usr/lib64/lazarus/components/printers/printer4lazarus.pas"
DescriptionA small GUI successfully built on Windows Vista fails to compile when ported to Linux (openSUSE and using the FPC and Lazarus installations from the openSUSE repositories). The code uses the package PrintersDlgs (the whole file is very long so not attached to this report for now).

Building on Linux generates the error message:

 Write error: Unable to create file "/usr/lib64/lazarus/components/printers/printer4lazarus.pas"
 File: /usr/lib64/lazarus/components/printers/printer4lazarus.pas
 package main source file

Note that /usr/lib64/lazarus/components/printers/printer4lazarus.pas already exists, put there as part of the installation and owned by root.

Clicking on Abort on the message box shows a second message:

 The package "Printer4Lazarus 0.5" failed to compile.
 Remove it from the installation list?

In fact, selecting the remove option doesn't solve the problem.


No application on Unix should be trying to write files to a subdirectory of /usr/lib64, so this appears either to be a coding bug or a design defect.
Steps To ReproduceIn the Lazarus IDE select Run->Build.
TagsNo tags attached.
Fixed in Revision43219
LazTarget-
WidgetsetGTK 2
Attached Files

Activities

Mattias Gaertner

2013-10-09 11:50

manager   ~0070695

The "package main source file" is auto created from the lpk.
It is only written if it has changed.
Please check if you have changed something in the lpk.

Gregg Moore

2013-10-10 21:19

reporter   ~0070732

Mattias,

I assume you mean printer4lazarus.lpk. On my installation this is:

-rw-r--r-- 1 root root 7161 Oct 24 2011 /usr/lib64/lazarus/components/printers/printer4lazarus.lpk

So it has not been modified for two years (and not by me -- I assume that is the date associated with the the file packaged in the rpm in the repository).

From the discussion on the forum <http://forum.lazarus.freepascal.org/index.php/topic,22279.0.html> it seems this defect was already known before I hit it. To check it wasn't specific to the code I'd ported to Linux, I used Lazarus on Linux to create a new project, with only the printer dialogue component on the form and nothing else. Compiling that generated the same error message.

Last, I compared the printer4lazarus.lpk files on Linux and Windows (using diff) and they were the same.

Please advise if there anything else you would like me to investigate.

Jesus Reyes

2013-10-10 21:58

developer   ~0070733

How do you run Lazarus?, using the lazarus command or startlazarus? if by icon on desktop or menu, what command runs that icon?

Mattias Gaertner

2013-10-11 01:37

manager   ~0070734

Please make a backup of the folder components/printers.
Then change the permissions to writable for everyone.
Compile the package.
Compare the old printer4lazarus.pas and the new file.

Do you see any differences?

Gregg Moore

2013-10-11 19:21

reporter   ~0070749

Jesus,

openSUSE with KDE has program launch facility similar to Windows's (old) start button. The command used to launch Lazarus is
 startlazarus %f

Mattias,

OK, I'll do that but it might take a day or two before I have the time to do so.

Please note that I did not package this for openSUSE (it was last packaged by an Asterios Dramis (email address in the package documentation withheld here) on Wed 07 Aug 2013, although the printer4lazarus.lpk clearly is much older than that) so I don't really know how that package was put together.

Gregg

Gregg Moore

2013-10-12 16:31

reporter   ~0070767

Mattias,

I assumed when you said "Compile the package" you meant try to compile my own code rather than meant run the Makefile in the components/printers/ directory.

So I changed the write permission to components/printers/ and all its subdirectories. I used the test application consisting of a form containing only the printer dialogue. This time that application built but the compilation also had the side effect of recreating some of the contents of the components/printers/ directory, namely the file:

-rw-rw-rw- 1 root root 392 Oct 12 14:28 printer4lazarus.pas

The only files changed in any of the subdirectories were:

components/printers/lib/x86_64-linux/gtk2:
-rw-rw-rw- 1 root root 204184 Oct 12 14:28 cupsdyn.o
-rw-rw-rw- 1 root root 116236 Oct 12 14:28 cupsdyn.ppu
-rw-rw-rw- 1 root root 127644 Oct 12 14:28 cupslcl.o
-rw-rw-rw- 1 root root 3616 Oct 12 14:28 cupslcl.ppu
-rw-rw-rw- 1 root root 72576 Oct 12 14:28 framepagesetup.o
-rw-rw-rw- 1 root root 24921 Oct 12 14:28 framepagesetup.ppu
-rw-rw-rw- 1 root root 189024 Oct 12 14:28 osprinters.o
-rw-rw-rw- 1 root root 25309 Oct 12 14:28 osprinters.ppu
-rw-r--r-- 1 user1 users 911 Oct 12 14:28 Printer4Lazarus.compiled
-rw-rw-rw- 1 root root 3700 Oct 12 14:28 printer4lazarus.o
-rw-rw-rw- 1 root root 1390 Oct 12 14:28 printer4lazarus.ppu
-rw-rw-rw- 1 root root 141068 Oct 12 14:28 printersdlgs.o
-rw-rw-rw- 1 root root 29161 Oct 12 14:28 printersdlgs.ppu
-rw-rw-rw- 1 root root 53756 Oct 12 14:28 udlgpagesetup.o
-rw-rw-rw- 1 root root 12665 Oct 12 14:28 udlgpagesetup.ppu
-rw-rw-rw- 1 root root 209564 Oct 12 14:28 udlgpropertiesprinter.o
-rw-rw-rw- 1 root root 79200 Oct 12 14:28 udlgpropertiesprinter.ppu
-rw-rw-rw- 1 root root 227848 Oct 12 14:28 udlgselectprinter.o
-rw-rw-rw- 1 root root 112798 Oct 12 14:28 udlgselectprinter.ppu

diff'ing the old printer4lazarus.pas against the new one shows no difference (other than it seems to have used my profile settings -- uppercasing reserved words -- in writing out the new file):

5c5
< unit Printer4Lazarus;
---
> UNIT Printer4Lazarus;
7c7
< interface
---
> INTERFACE
10c10
< PrintersDlgs, OSPrinters, LazarusPackageIntf;
---
> PrintersDlgs, OSPrinters, LazarusPackageIntf;
12c12
< implementation
---
> IMPLEMENTATION
14,17c14,17
< procedure Register;
< begin
< RegisterUnit('PrintersDlgs', @PrintersDlgs.Register);
< end;
---
> PROCEDURE Register;
> BEGIN
> RegisterUnit('PrintersDlgs',@PrintersDlgs.Register);
> END;
19,21c19,21
< initialization
< RegisterPackage('Printer4Lazarus', @Register);
< end.
---
> INITIALIZATION
> RegisterPackage('Printer4Lazarus',@Register);
> END.

I removed the global write permission for components/printers/ and its subdirectories, and changed the ownership of the file components/printers/lib/x86_64-linux/gtk2/Printer4Lazarus.compiled back to root. Then I relaunched Lazarus and repeated the creation of a simple form with only the print dialogue. This time the application built and ran.

Does this suggest there is a problem with the openSUSE rpm (installation package)? If so, are you able to be specific about what the package creator should fix?

Gregg

Issue History

Date Modified Username Field Change
2013-10-09 11:39 Gregg Moore New Issue
2013-10-09 11:50 Mattias Gaertner Note Added: 0070695
2013-10-10 21:19 Gregg Moore Note Added: 0070732
2013-10-10 21:58 Jesus Reyes Note Added: 0070733
2013-10-11 01:37 Mattias Gaertner Note Added: 0070734
2013-10-11 15:22 Mattias Gaertner Assigned To => Mattias Gaertner
2013-10-11 15:22 Mattias Gaertner Status new => assigned
2013-10-11 19:21 Gregg Moore Note Added: 0070749
2013-10-12 16:31 Gregg Moore Note Added: 0070767
2013-10-12 16:54 Mattias Gaertner Fixed in Revision => 43219
2013-10-12 16:54 Mattias Gaertner LazTarget => -
2013-10-12 16:54 Mattias Gaertner Status assigned => resolved
2013-10-12 16:54 Mattias Gaertner Resolution open => fixed