Skip to content

SQLiteJournal: filesystem permissions like ordinary file - #30

Merged
milo merged 1 commit into
nette:masterfrom
milo:pull-29-permissions
Apr 3, 2016
Merged

SQLiteJournal: filesystem permissions like ordinary file#30
milo merged 1 commit into
nette:masterfrom
milo:pull-29-permissions

Conversation

@milo

@milo milo commented Aug 16, 2015

Copy link
Copy Markdown
Member

SQLiteJournal is used with the FileCache. Seems correct to me, it should behave in the same way as ordinary files.

@milo

milo commented Aug 16, 2015

Copy link
Copy Markdown
Member Author

I didn't find a more systematic way.

@milo
milo force-pushed the pull-29-permissions branch from 518aa60 to b5a505f Compare September 7, 2015 12:17
@JanTvrdik

Copy link
Copy Markdown
Contributor

I don't like the is_file call but I don't have a better solution.

@Unlink

Unlink commented Sep 14, 2015

Copy link
Copy Markdown

What about

if ($path !== ':memory:') {
    touch($path);
}

@JanTvrdik

Copy link
Copy Markdown
Contributor

@Unlink 👍 for touch

EDIT: or maybe not, I don't know.

Comment thread src/Caching/Storages/SQLiteJournal.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if fopen returns false?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

@milo

milo commented Sep 14, 2015

Copy link
Copy Markdown
Member Author

Syscalls of solutions:

# touch() - first
access("/tmp/file.touch", F_OK)         = -1 ENOENT (No such file or directory)
open("/tmp/file.touch", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
close(4)                                = 0
utime("/tmp/file.touch", NULL)

# touch() - every next
access("/tmp/file.touch", F_OK)         = 0
utime("/tmp/file.touch", NULL)          = 0


# is_file() - first
stat("/tmp/file.touch", 0x7fff3333d540) = -1 ENOENT (No such file or directory)
lstat("/tmp/file.touch", 0x7fff3333b330) = -1 ENOENT (No such file or directory)
open("/tmp/file.touch", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4

# is_file() - every next
stat("/tmp/file.touch", {st_mode=S_IFREG|0660, st_size=0, ...}) = 0

@JanTvrdik

Copy link
Copy Markdown
Contributor

What about !is_file + touch.

@milo
milo force-pushed the pull-29-permissions branch from b5a505f to 3f8a80b Compare October 17, 2015 20:22
@milo milo added this to the v2.4 milestone Mar 29, 2016
@milo
milo force-pushed the pull-29-permissions branch 2 times, most recently from 667fb80 to 73d31b8 Compare April 3, 2016 09:09
@milo
milo merged commit 73d31b8 into nette:master Apr 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants