Recent

Author Topic: Source code regressions/corruption by Lazarus  (Read 6996 times)

new2linux

  • Jr. Member
  • **
  • Posts: 60
Source code regressions/corruption by Lazarus
« on: May 22, 2014, 10:27:39 pm »
I am running the latest Lazarus on Xubuntu in Virtualbox. Shared folders do not work, so I mostly develop in Windows and copy the whole unit-text from the Windows IDE to the Linux IDE. Then I press Ctrl+S, saving.

Never ever do I paste files below Lazarus. Never ever do I work the other way: I edit in Windows and paste the text into the unit in Lazarus on Linux.
Because Windows works almost fluently, but Linux is slow and a hassle with multiple windows and is otherwise a PITA.

Nevertheless Lazarus irregularly prompts me: "Some files have changed on disk", "Ignore changes?", "Reload from disk?"

I chose to ignore. But misteriously features are lost and bugs already fixed reappear. Now the first thing is to doubt my sanity, and so I did, but as I have been adhering religiously to the protocol above, no other explanation comes to mind. Especially since NO such messages should occur!

Might it have to do with the difference between time handling? Seems absurd, as I only paste new text, not files. 

I had this type of code regressions with Delphi back in the day (15 years ago). Suddenly I found myself solving the same old bugs again. But Delphi did not prompt me. I guess it happened exiting the IDE with a buggy AutoSave feature. But I do not exit Lazarus.

I guess this is just an alert; maybe this gets others to post similar experiences.

This seems limited to Linux.

PS thinking about this, this maybe a clue: the app itself copies the folder it is (alongside the source code) in to another folder. So it touches the source files. Lazarus may be interpreting the touch as a change.

If this is the case, checking the checkbox "Compare content" in the prompt Lazarus gives me does not help. Only remembering the file content at the prior date (with a hash), allows Lazarus to detecting real *changes*, not just a change in the filedate.

So this probably triggers the problems, but nevertheless they should not occur. It explains why this occurs on Linux only because Windows does not log read accesses to files.

But maybe I am doing cross-platform development the wrong way. Any tips would be helpful. Should I develop only on Windows?








Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Source code regressions/corruption by Lazarus
« Reply #1 on: May 22, 2014, 10:56:08 pm »
Are 100% sure that the "native" windows project and all its files is in different directory than linux project and that linux project contains no symlinks?

I don't know if it can be some wrong setting of VirtualBox, I have not much experience with it.
Lazarus 2.1.0 r59757M FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.2, Plasma 5.14.2
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

howardpc

  • Hero Member
  • *****
  • Posts: 3176
Re: Source code regressions/corruption by Lazarus
« Reply #2 on: May 22, 2014, 11:12:42 pm »
Does Virtualbox not support shared folders?
Having to cut and paste code between 'identical' but different files sounds like a maintenance nightmare.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5691
    • wiki
Re: Source code regressions/corruption by Lazarus
« Reply #3 on: May 23, 2014, 04:22:00 pm »
Watch the system clock.

Maybe it changes for some reason?

You get that message twice a year when the time changes between daylight saving and not-daylight saving.


wp

  • Hero Member
  • *****
  • Posts: 6301
Re: Source code regressions/corruption by Lazarus
« Reply #4 on: May 23, 2014, 05:48:39 pm »
Quote
Shared folders do not work
They do in my virtual box with Ubuntu. It was a bit tricky to get it working: you have to mount the shared folder in addition to enabling the shared folder in the VirtualBox additions.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

avra

  • Hero Member
  • *****
  • Posts: 1711
    • Additional info
Re: Source code regressions/corruption by Lazarus
« Reply #5 on: May 27, 2014, 11:03:05 am »
It seams you want to develop on Windows and deploy on Linux. If you can't make VM shared folders work, then most similar to your approach would be to copy files from Windows to Linux. You can use WinSCP or TotalCommander with TFTP plugin for that, and you will need to provide your SSH login credentials. Alternatively you can set FTP server on Linux and access files via some FTP client (like Total Commander), or use Novel NetDrive to map FTP dir to a local windows drive letter (unfortunately it is Win32 only application). While developing some GCC linux application some time ago, I used UltraEdit which could be set to edit files over FTP, compile from IDE and see all verbose GCC compilation output directly in IDE. I also don't see why don't you simply cross compile. It is not hard to set FPCUP or CodeTyphon for this task.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Source code regressions/corruption by Lazarus
« Reply #6 on: May 27, 2014, 11:31:12 am »
It seams you want to develop on Windows and deploy on Linux. If you can't make VM shared folders work, then most similar to your approach would be to copy files from Windows to Linux.
As avra said you can use various approaches:
- FTP
- NFS (probably a bit tricky, you'd need an NFS client on Windows)
- SFTP (using SSH)
- SCP (using SSH)
- SMB/Samba (windows file sharing)

I would suggest using the latter as you can simply drag and drop from windows explorer to your linux machine.
SCP/SFTP is probably easiest to set up as you quite probably have a running SSH server; you'd only need a client program on your Windows machine such as WinSCP.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

new2linux

  • Jr. Member
  • **
  • Posts: 60
Re: Source code regressions/corruption by Lazarus
« Reply #7 on: May 28, 2014, 06:45:40 pm »
Sorry for the late answers. The result is a mishmash.

> Are 100% sure that the "native" windows project and
> all its files is in different directory than linux project
> and that linux project contains no symlinks?

yes. its is in a clean Xubuntu in virtualbox and I did not get shared folders working. there is no hidden connection.


> Does Virtualbox not support shared folders?

normally it does, but I could not get it to work. Vbox also shouldn't crash, but it regularly does.

> Having to cut and paste code between 'identical' but
> different files sounds like a maintenance nightmare.

Yes. For that reason I work exclusively in Windows and only test on Linux: to avoid the nightmare scenario.

Windows works better for me in every way.

> Watch the system clock.
> Maybe it changes for some reason?
> You get that message twice a year when the
> daylight saving changes.

daylight isn't the problem. the clock doesn't seem to be the problem.

the real problem is that I lose data when I shouldn't. after all, the file is open in Lazarus and I am working with it.

or maybe the problem is the clock, because I start out with a set of files received through email as a zip, extracted into a set of folders. so the issue could possibly arise from the WRONG interpretation of archived filetimes.

this would explain the prompts I get, but it doesn't explain the misterious corruption that subsequently occurs or seems to occur, as I can't pin down why edits get lost.



> They [shared folders] do in my virtual box with Ubuntu.
> It was a bit tricky to get it working

everything in Linux is more tricky than it needs to be. the solutions it offers are not the solutions needed. the system works gainst the user.


> you have to mount the shared folder in addition to
> enabling the shared folder in the VirtualBox additions.

I have seen this on the net. couldn't get it working. wasted enough time as it is. please give me a .vdi of a clean ubuntu, whatever... ;)


> It seams you want to develop on Windows and
> deploy on Linux.

yes. on both actually.


> If you can't make VM shared folders work, then
> most similar to your approach would be to copy
> files from Windows to Linux.

which is what I am doing, through email to set things up. then while editing I use copynpaste, always from Windows to the VM.


> I also don't see why don't you simply cross compile.
> It is not hard to set FPCUP or CodeTyphon for this task.

This would be good to have anyway. I'll look into this. Thanks.


> I would suggest using the latter [SMB/Samba
> (windows file sharing)] as you can simply drag
> and drop from windows explorer to your linux
> machine.

perhaps. but it seems like another promise. what hassles will that get me in to?

it seems to me I have pretty straightforward needs regarding Linux. hey, I am installing this in a VM, which the devs are probably using! this is the most easily tested platform! yet there is a neverending amount of shit to go through.

Anyway thank you all.


Rails

  • Guest
Re: Source code regressions/corruption by Lazarus
« Reply #8 on: May 28, 2014, 07:19:58 pm »
OK, if I understand correctly, you are developing in Windows then copying the source to a Linux installation and compiling for Linux on the Linux machine. I do something similar, but on two different Linux machines, one 64 bit and the other 32. 

A sure fire way to have a problem with this sort of process is have the target machine's Lazarus installation up and running when you paste the source into its folder. If that is what you are doing, try killing Lazarus on the Linux box until you are done pasting stuff over from Windows.
 
Edit: I reread your original post. I misunderstood and didn't get that you are actually cutting and pasting between running apps. That isn't what I do, so my advice probably won't help, but I'll leave it up anyway, just in case.

Hmm, how do the different EOL characters impact things when cutting and pasting between Windows and Linux? 
« Last Edit: May 28, 2014, 07:36:57 pm by Rails »