FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu May 13, 2021 21:01



Post new topic Reply to topic  [ 6 posts ] 
hide_hid_files/hide_dot_files hide wrong files 
Author Message

Joined: Sat Mar 10, 2012 13:24
Posts: 2
Post hide_hid_files/hide_dot_files hide wrong files
Hi all!

I've been using ntfs-3g for years. I need it to access my NTFS shared data partition from Linux. Some time ago, I had the need of changing file permissions, and read this manual. I found quickly the option I was looking for, but also noticed the hide_hid_files and hide_dot_files ones. Simply awesome, finally I could get rid of those annoying $RECICLE.BIN, RECYCLER and System Volume Information folders. Moreover, now I don't need to create dot folders on Linux (Windows doesn't allow folders beginning with a dot) and then hide them on Windows in order to have an OS-independant hidden folder: dot names created on Linux are automatically hidden on Windows, and files/folder hidden on Windows don't appear on Linux (not even with 'ls -a').

Yesterday, I was going to modify a very important script stored in my data partition. Panic! It was not there! After a while, when my heart continued pumping, I used testdisc/photorec to recover data on non-allocated space. OMFG, nothing... Then I had a hunch, went to Windows, set hidden files to be shown, and ufff... that was close. My script was there, hidden, though nobody had hidden it, neither on Windows nor on Linux. "Well, shit happens", I thought. I unhided it and returned to Linux. The file was there, I could modify the lines I wanted. Today I decided to check if the file was still there (maybe another hunch), and guess what? It wasn't!

The file is located in /media/SILO/Linux/software/exoconf (data partition /dev/sda2 is mounted on /media/SILO). File name does not begin with a dot, and I didn't hide it in any way. I can 'ls /media/SILO/Linux/software/exoconf', so the script is there (but 'ls -a /media/SILO/Linux/software/ | grep exoconf' has no results).

Any workaround?


Sat Mar 10, 2012 14:11
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: hide_hid_files/hide_dot_files hide wrong files
Hi,

Quote:
The file is located in /media/SILO/Linux/software/exoconf (data partition /dev/sda2 is mounted on /media/SILO). File name does not begin with a dot, and I didn't hide it in any way. I can 'ls /media/SILO/Linux/software/exoconf'

Maybe your file can be accessed through another name. What are the outputs (when exoconf appears to be hidden) of :
Code:
stat /media/SILO/Linux/software/exoconf
getfattr -e hex -n system.ntfs_attrib  /media/SILO/Linux/software/exoconf

Quote:
ls -a /media/SILO/Linux/software/ | grep exoconf' has no results

The "-a" option has no effect when "hide_hid_files" is used. The file system cannot know the "-a" is used, and it does not return hidden files.

Regards

Jean-Pierre


Sat Mar 10, 2012 15:45
Profile

Joined: Sat Mar 10, 2012 13:24
Posts: 2
Post Re: hide_hid_files/hide_dot_files hide wrong files
Think I've solved the mystery. I tried creating the text file (actually copying an existing one) /media/SILO/test.txt. Opened it with gedit, added some text and saved it. Pressed F5 to refresh nautilus, et voilà, file was missing. Tried the same with /media/SILO/test4.txt removing hide_dot_files from my fstab (and remounting the partition), and file does not disappear.

If I remember right, many years ago (think I used Mandrake Linux by that time), I used to have lots of weird files when modifying others, say I edited something.txt and ~something.txt or so appeared. Is it possible when you edit a file, changes are stored in some kind of .something.txt (hide_dot_files would set ntfs hidden attribute), then you save it and internally there's a "rm something.txt && mv .something.txt something.txt" (now it's not a dot file, but it's ntfs hidden)? Does it make sense?

If it helps, I include my fstab entry (first one hides files when edited, second one works as I want) and the results of the commands Jean-Pierre said, both for test.txt (hidden after edit) and test4.txt (not hidden):

Code:
/dev/sda2 /media/SILO ntfs-3g defaults,users,exec,uid=1000,gid=1000,dmask=0022,fmask=0033,hide_hid_files,hide_dot_files,windows_names,utf8 0 0

/dev/sda2 /media/SILO ntfs-3g defaults,users,exec,uid=1000,gid=1000,dmask=0022,fmask=0033,hide_hid_files,windows_names,utf8 0 0

exodoom@cabal ~ $ stat /media/SILO/test.txt
  File: «/media/SILO/test.txt»
  Size: 393          Blocks: 1          IO Block: 4096   fichero regular
Device: 802h/2050d   Inode: 20135       Links: 1
Access: (0744/-rwxr--r--)  Uid: ( 1000/ exodoom)   Gid: ( 1000/ exodoom)
Access: 2012-03-10 23:03:46.894980000 +0000
Modify: 2012-03-10 23:03:46.896258000 +0000
Change: 2012-03-10 23:03:46.896664000 +0000

exodoom@cabal ~ $ getfattr -e hex -n system.ntfs_attrib /media/SILO/test.txt
getfattr: Eliminando «/» inicial en nombres de ruta absolutos
# file: media/SILO/test.txt
system.ntfs_attrib=0x22000000

exodoom@cabal ~ $ stat /media/SILO/test4.txt
  File: «/media/SILO/test4.txt»
  Size: 348          Blocks: 1          IO Block: 4096   fichero regular
Device: 802h/2050d   Inode: 20140       Links: 1
Access: (0744/-rwxr--r--)  Uid: ( 1000/ exodoom)   Gid: ( 1000/ exodoom)
Access: 2012-03-10 23:07:56.682759000 +0000
Modify: 2012-03-10 23:07:56.690281000 +0000
Change: 2012-03-10 23:07:56.690730000 +0000

exodoom@cabal ~ $ getfattr -e hex -n system.ntfs_attrib /media/SILO/test4.txt
getfattr: Eliminando «/» inicial en nombres de ruta absolutos
# file: media/SILO/test4.txt
system.ntfs_attrib=0x20000000


Sun Mar 11, 2012 01:42
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: hide_hid_files/hide_dot_files hide wrong files
Hi,

Quote:
Is it possible when you edit a file, changes are stored in some kind of .something.txt (hide_dot_files would set ntfs hidden attribute), then you save it and internally there's a "rm something.txt && mv .something.txt something.txt" (now it's not a dot file, but it's ntfs hidden)? Does it make sense?

Yes, that is the likely cause (not easy to check because generally the temporary name is a random one). When renaming a file, the "hidden" attribute is kept unchanged. Do you want to test a scenario in which the hidden attribute is set according to the latest name, when hide_dot_files is set ?
Code:
exodoom@cabal ~ $ getfattr -e hex -n system.ntfs_attrib /media/SILO/test.txt
getfattr: Eliminando «/» inicial en nombres de ruta absolutos
# file: media/SILO/test.txt
system.ntfs_attrib=0x22000000

This file is indeed hidden, this is what I wanted to check.
Now, if you want to un-hide it, you can do :
Code:
setfattr -v 0x00000000 -n system.ntfs_attrib /media/SILO/test.txt

Just do not do that on special files (symlinks, fifos, etc.)

** edit **

Attached is a patch for setting the "hidden" flag according to the latest name, when hide_dot_files is set :

Code:
# create a hidden file
touch .example
# rename it, so not hidden any more
mv .example example
# rename to original name, so hidden again
mv example .example
# create another hidden file
touch .another
# define a second name, not hidden any more
ln .another another


Can you check whether this suits your needs ?

Regards

Jean-Pierre


Attachments:
dir.c.patch47.gz [387 Bytes]
Downloaded 777 times
Sun Mar 11, 2012 09:51
Profile

Joined: Mon May 14, 2012 01:01
Posts: 1
Post hide_hid_files/hide_dot_files hide wrong files
I have a directory shared from my linux server to my home network using netatalk. There are lots of .DS_Store files and .AppleDouble directories all over the place. When I share this directory with RetroShare, it picks up all of these directories and files. Is there a way to make RetroShare ignore dot files when indexing a directory to share?

Thanks,
Tim


Mon May 14, 2012 21:45
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: hide_hid_files/hide_dot_files hide wrong files
Hi,

Quote:
Is there a way to make RetroShare ignore dot files when indexing a directory to share?

Try using option "hide_hid_files"

Regards

Jean-Pierre


Wed May 16, 2012 22:14
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.