Skip to content

Conversation

@milo
Copy link
Member

@milo milo commented Aug 16, 2015

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

@milo
Copy link
Member Author

milo commented Aug 16, 2015

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
Contributor

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

@Unlink
Copy link

Unlink commented Sep 14, 2015

What about

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

@JanTvrdik
Copy link
Contributor

@Unlink 👍 for touch

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

Copy link
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
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
Copy link
Member Author

milo commented Sep 14, 2015

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
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