Bash is caching a file path

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
djungk

Bash is caching a file path

Post by djungk »

Hi,

I'm using a bash file like this:

cd /home/dpjungk/djApps/Hal2
./Hal2 /home/dpjungk/Biz/Wep2.hal code

Hal2 is a program that I wrote
Wep2.hal is a text file
The 'code' argument instructs the program which of two ways it can open the file

This much worked fine until I edited the text file in a text editor.
The Hal2 program caches nothing. It saves nothing to disk. It simply displays the file in a formatted way.

I edited the Wep2.hal file in a text editor and now I'm getting a strange result:
Executing the bash file opens the *original* file in the Hal2 program. It opens a file that does not exist in the file system!

If I open Hal2 and open through the menus, it opens the new file. If I drag the new file to the Hal2 icon, it opens the new file. but if I use the bash file, it is still remembering the *content* of the original text file.

How is this possible? Is bash caching this in a file somewhere?
I deleted bash history. I restarted the computer.

Do I need an exorcist?

Mint 18 Sarah, 32 bit, MATE 1.14.1

Don

Thank you for your time
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
MintBean

Re: Bash is caching a file path

Post by MintBean »

We'd really need to see the program.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Bash is caching a file path

Post by rene »

djungk wrote:How is this possible? Is bash caching this in a file somewhere?
No. This reply basically only to assure you that indeed your report makes no sense. Only thing that came to mind was you "having edited Wep2.hal" but in fact still having it open in the editor, not in fact having saved it. Sort of expect you'd have noticed though. No virtualization environments such as Firejail in use?

In a startling 100% of cases up to now encountered by me however, a computer doing something unexpected is due to operator's expectations being off. I take it that Hal2 is a bash script? You may need to post it; rather doubt anyone will be able to say something sensible without reproducing locally...
djungk

Re: Bash is caching a file path

Post by djungk »

I take it that Hal2 is a bash script?
No, it is a compiled program written in Xojo. It simply decodes a text file into a readable format.
Only thing that came to mind was you "having edited Wep2.hal" but in fact still having it open in the editor, not in fact having saved it.
No, It has been saved. If I display it by selecting it from the Open dialogf of Hal2, it displays correctly. It only displays incorrectly if I launch it with the bash file.

If I change the bash script, like moving things to a new folder, it opens the new correct file. It is somehow remembering what it passed to the program the time before.

Thank you for your time,
Don
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Bash is caching a file path

Post by rene »

Seeing as how Hal2 apparantly wasn't "the bash file", to guard against me misinterpreting something, I gather that "the bash file" and "the bash script" are two interchangeable ways of referring to a bash script that contains the "./Hal2 Web2.hal code" command.

I can still assure you that nothing of a caching nature is taking place at the shell level. If you are not in some sort of weird virtualization environment it seems this being Xojo specific is the only possibility; the Xojo RTL caching things behind your back. Yes, seems weird that it wouldn't when the file's opened through ./Hal2's open dialog but I don't know Xojo; perhaps an explicit "cache sync" is part of the code for said dialog, whereas this is not the case for the parameter-method, even though you still in fact need it. Caching by default does seem to make some sense for what appears to be some form of Web-development language.

Quickest way of confirming/denying could be to forcefully clear any and all Xojo caches and see if the issue persists. Once again, do not know Xojo, but check in for example ~/.xojo, ~/.config/xojo, ~/.cache/xojo, ...

If no, out of suggestions. But rest assured this is not a bash issue.
djungk

Re: Bash is caching a file path

Post by djungk »

Hi Rene,
You are right it is not a bash problem. It is not a caching problem at all, but as you or another said, it is human error.

The Hal2 program takes a comandline argument "code" which directs it to open and display the info in a particular way. In the same directory with the file it was opening, I had left another file named "code" that I had used during the development of the program. The program was opening the correct file and then replacing it on the screen by opening the second file.

Sorry for wasting time, and thank you,
Don
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Bash is caching a file path

Post by rene »

Thanks for reporting back. Yeah, invariably things like this turn out annoyingly pedestrian. Computers are just no fun...
Locked

Return to “Software & Applications”