VFS Module - "Hide Dot At Top"

Alun Jones [auj] auj at aber.ac.uk
Tue Oct 15 09:17:07 UTC 2019


Hi all,

I thought I'd submit this one as it might help someone else. If it ended up
in the distribution sources, I'd be delighted!

Background
==========

Back in January I encountered an interesting problem with Samba's
magic hiding of dot files. A piece of software was creating a lock
file, deep within a share, starting with a ".", then trying to delete it
moments later. With "hide dot files" on, the software was unable to
delete it because Windows was unwilling to delete a hidden file.

I didn't want to turn "hide dot files" off, since this would make
all Linux "~/.*" files visible under Windows (we have dual-boot
machines in our teaching labs, so almost everyone ends up with a bunch
of dotfiles over time).

So, at the time, I knocked together a very hacky solution by binary
patching the misbehaving software to use "_" as the first
letter of its lock file instead. Not a long term solution but it
allowed me to make a minimal change without affecting everyone else.

There's a full write-up of the saga at:

https://www.ty-penguin.org.uk/~auj/blog/2019/01/24/hidden/

Getting to the point
====================

It seemed to me that the best long-term approach was to use a VFS
module to hide dotfiles just at the top directory of the share,
while leaving them visible in subdirectories. Using vfs_offline
as a template I've done just that. It appears to work, so I thought
I'd submit it back, just in case anyone else finds it useful.

Usage
=====

In a share definition, add:

    hide dot files = no
    vfs objects = hide_dot_at_top

Source code
===========

See attached.

--
Dr. Alun Jones,         auj at aber.ac.uk,            01970 622637
Mathemateg, Ffiseg a Chyfrifiadureg,      Prifysgol Aberystwyth
Mathematics, Physics & Computer Science, Aberystwyth University


--------------------------------------------------------------------
Prifysgol Aberystwyth www.aber.ac.uk
Prifysgol y Flwyddyn ar gyfer Ansawdd Dysgu - The Times & The Sunday Times 2019.

Aberystwyth University www.aber.ac.uk
University of the Year for Teaching Quality - The Times & The Sunday Times 2019.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vfs-hide-dot-at-top.patch
Type: text/x-patch
Size: 7662 bytes
Desc: vfs-hide-dot-at-top.patch
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20191015/f671681a/vfs-hide-dot-at-top.bin>


More information about the samba-technical mailing list