You are not logged in.

#1 2016-04-02 12:22:48

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

[SOLVED] Weird file

If this is in the wrong place, please move it.

I have a scripts directory in ~/  where I store my own scripts. In case it's relevant, this directory is in my $PATH.

There is a file in the directory, 0 bytes long, called 1024. I can delete the file, and it is immediately recreated. I can confirm deletion by moving it to the trash rather than an instant delete, and it still gets recreated. Checking trash shows the deleted version there.

Does anyone know what this file is, or how to check what is recreating it?

lightdm, xfce using Thunar as my filemanager.

Deleting via the terminal with and without sudo and it still gets recreated.

Last edited by Roken (2016-04-02 18:42:31)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#2 2016-04-02 12:43:36

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] Weird file

Check lsof's output and see if any process has that file opened. Also, take a look here: http://unix.stackexchange.com/a/13791

Offline

#3 2016-04-02 18:42:10

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: [SOLVED] Weird file

lsof didn't help, and I wasn't going to compile a kernel with auditing just for this.

However, I did notice that it was accessed every one second, which gave me a clue - something to do with conky.

Since it was created in the scripts directory, it was a fair bet that it was one of the scripts called by conky. Now, there are only four, which certainly narrowed it down, and three of them are one or two liners, which meant I had to go to the longer one having verified all three of them.

Still took half an hour, but I found it. The script had a "greater than" test using ">" which I hadn't escaped. Rather than erroring out, bash just treated it as a redirection. Since the test was greater than 1024, it simply created a file called 1024 every time.

Doh!

Thanks anyway.

Last edited by Roken (2016-04-02 18:43:28)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#4 2016-04-03 08:52:32

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] Weird file

Roken wrote:

The script had a "greater than" test using ">" which I hadn't escaped. Rather than erroring out, bash just treated it as a redirection. Since the test was greater than 1024, it simply created a file called 1024 every time.

Doh!

Thanks anyway.

Haha, glad you could sort it out.

As for using the > operator, I would suggest you use -gt instead, that is assuming you are using [ or [[.

Offline

#5 2016-04-03 14:06:20

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: [SOLVED] Weird file

-gt only tests integers, whereas my tested number was a float, meaning that I couldn't use it sad


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

Board footer

Powered by FluxBB