Keeping -wal and -shm files

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Keeping -wal and -shm files

Steinar Midtskogen
I have a database that is updated (written) by one user and read by
another user.  So I use WAL mode to get concurrency.  I'm running
Linux/ext4.

Both users are members of the same group.  The trouble is that Linux
ignores the setgid bit on the directory, so when a user access the
database, they will create the -wal and -shm files using their default
group, not the directory group of which they're both members.  So when
one is accessing the database, the other gets locked out because the
-wal and -shm files are created with the wrong group id.

Is there a way to prevent the -wal and -shm files from being deleted
after use, so that I can have them always have the right group?  Or is
there a way to tell Linux to observe the setgid flag on a directory
(ext4)?

--
Steinar Midtskogen
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Keeping -wal and -shm files

James K. Lowden
On Mon, 27 Oct 2014 12:33:59 +0100
Steinar Midtskogen <[hidden email]> wrote:

> Is there a way to prevent the -wal and -shm files from being deleted
> after use, so that I can have them always have the right group?  Or is
> there a way to tell Linux to observe the setgid flag on a directory
> (ext4)?

See -o grpid in mount(8).  I think that's what you want.  

--jkl

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Keeping -wal and -shm files

Steinar Midtskogen
"James K. Lowden" <[hidden email]> writes:

> See -o grpid in mount(8).  I think that's what you want.  

Thanks.  It works!

--
Steinar
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Keeping -wal and -shm files

David Woodhouse
In reply to this post by James K. Lowden
On Mon, 2014-10-27 at 12:27 -0400, James K. Lowden wrote:
> On Mon, 27 Oct 2014 12:33:59 +0100
> Steinar Midtskogen <[hidden email]> wrote:
>
> > Is there a way to prevent the -wal and -shm files from being deleted
> > after use, so that I can have them always have the right group?  Or is
> > there a way to tell Linux to observe the setgid flag on a directory
> > (ext4)?
>
> See -o grpid in mount(8).  I think that's what you want.  

Hm, if the directory really is setgid then you shouldn't *need* -ogrpid.

--
dwmw2

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Keeping -wal and -shm files

James K. Lowden
In reply to this post by Steinar Midtskogen
On Mon, 27 Oct 2014 17:41:53 +0100
Steinar Midtskogen <[hidden email]> wrote:

> "James K. Lowden" <[hidden email]> writes:
>
> > See -o grpid in mount(8).  I think that's what you want.  
>
> Thanks.  It works!

Hmm, I'm glad, but as David Woodhouse pointed out, it shouldn't have
been necessary.  Your question was:

> On Mon, 27 Oct 2014 12:33:59 +0100
> Steinar Midtskogen <[hidden email]> wrote:
>
> > is there a way to tell Linux to observe the setgid flag on a
> > directory (ext4)?

and -o grpid changes the directory's *gid* effect, not setgid.  Are you
sure that the directory is setgid?  

$ ls -ld steinar
drwxrwxr-x  2 jklowden  wheel  512 Oct 28 09:54 steinar
$ chmod 2775 steinar
$ ls -ld steinar
drwxrwsr-x  2 jklowden  wheel  512 Oct 28 09:55 steinar
             ^--- note "s" in permission bit

You may be more used to traditional BSD behavior, which -o grpid
restores.  

--jkl
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Keeping -wal and -shm files

Steinar Midtskogen
"James K. Lowden" <[hidden email]> writes:

> and -o grpid changes the directory's *gid* effect, not setgid.  Are you
> sure that the directory is setgid?  
>
> $ ls -ld steinar
> drwxrwxr-x  2 jklowden  wheel  512 Oct 28 09:54 steinar
> $ chmod 2775 steinar
> $ ls -ld steinar
> drwxrwsr-x  2 jklowden  wheel  512 Oct 28 09:55 steinar
>              ^--- note "s" in permission bit

Aah.  Thanks for pointing this out.  The directory was drwsrwxr-x.  I
changed it to drwxrwsr-x and it works as expected without grpid.

> You may be more used to traditional BSD behavior, which -o grpid
> restores.  

No, I must have mixed up 4775 and 2775.  I'm unable to set g+s/2775 as
user (even though I own the directory), it only works as root, so
perhaps I did 4775 when 2775 didn't do anything (while I've been on
Linux for more than 20 years, I rarely touch these flags so I usually
don't remember which bit is which).  It took a while after I set the
permissions before I discovered that it didn't work, and I've assumed
that the flags were right.

--
Steinar
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users