Re: Safe file update library ready (sort of)

2011-02-08 Thread Shachar Shemesh
On 06/02/11 18:40, Goswin von Brederlow wrote: I absolutely hate that. A header file should be compilable on its own. The times when #includefoo.h would slow down the compiler are long gone and all include files are protected with #ifndef NAME so duplicate includes are harmless. On the other

Re: Safe file update library ready (sort of)

2011-02-06 Thread Goswin von Brederlow
Shachar Shemesh shac...@debian.org writes: On 26/01/11 13:03, Goswin von Brederlow wrote: Some things I noticed: safewrite.h: - missing headers, e.g. for mode_t No. That's intentional. I'm assuming the people who will use safewrite.h are going to RTFM, where it clearly says that those

Re: Safe file update library ready (sort of)

2011-02-05 Thread Shachar Shemesh
On 26/01/11 13:03, Goswin von Brederlow wrote: Some things I noticed: safewrite.h: - missing headers, e.g. for mode_t No. That's intentional. I'm assuming the people who will use safewrite.h are going to RTFM, where it clearly says that those includes are needed. I might reconsider if

Re: Safe file update library ready (sort of)

2011-01-29 Thread Ted Ts'o
On Fri, Jan 28, 2011 at 07:37:02AM +0100, Olaf van der Spek wrote: Is there a way to log cases where (potentially) unsafe writes happen? Cases like truncation of an existing file, rename on a target that's not yet synced, etc. Not really, because there are plenty of cases where it's

Re: Safe file update library ready (sort of)

2011-01-29 Thread Olaf van der Spek
On Sat, Jan 29, 2011 at 1:53 PM, Ted Ts'o ty...@mit.edu wrote: On Fri, Jan 28, 2011 at 07:37:02AM +0100, Olaf van der Spek wrote: Is there a way to log cases where (potentially) unsafe writes happen? Cases like truncation of an existing file, rename on a target that's not yet synced, etc.

Re: Safe file update library ready (sort of)

2011-01-29 Thread Goswin von Brederlow
Hendrik Sattler p...@hendrik-sattler.de writes: char buffer[0]; is veeery gcc-specific as the storage size of buffer is 0. According to the C99 standard: 6.7.5.2 Array declarators Constraints 1 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit an

Re: Safe file update library ready (sort of)

2011-01-28 Thread Salvo Tomaselli
On Friday 28 January 2011 03:26:42 Ted Ts'o wrote: On Wed, Jan 26, 2011 at 06:14:42PM +0100, Olaf van der Spek wrote: On Wed, Jan 26, 2011 at 5:36 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: BTW: KDE4 is a very good example for failure with modern filesystems. I regularly

Re: Safe file update library ready (sort of)

2011-01-27 Thread Michael Bienia
On 2011-01-26 17:36:19 +0100, Hendrik Sattler wrote: Zitat von Goswin von Brederlow goswin-...@web.de: Hendrik Sattler p...@hendrik-sattler.de writes: Zitat von Goswin von Brederlow goswin-...@web.de: typedef struct { int fd; char buffer[0]; } safe_t; and allocating

Re: Safe file update library ready (sort of)

2011-01-27 Thread Ted Ts'o
On Wed, Jan 26, 2011 at 06:14:42PM +0100, Olaf van der Spek wrote: On Wed, Jan 26, 2011 at 5:36 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: BTW: KDE4 is a very good example for failure with modern filesystems. I regularly loose configuration files when suspend-to-ram fails even if the

Re: Safe file update library ready (sort of)

2011-01-27 Thread Olaf van der Spek
On Fri, Jan 28, 2011 at 3:26 AM, Ted Ts'o ty...@mit.edu wrote: On Wed, Jan 26, 2011 at 06:14:42PM +0100, Olaf van der Spek wrote: On Wed, Jan 26, 2011 at 5:36 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: BTW: KDE4 is a very good example for failure with modern filesystems. I regularly

Re: Safe file update library ready (sort of)

2011-01-26 Thread Goswin von Brederlow
Ian Jackson ijack...@chiark.greenend.org.uk writes: Shachar Shemesh writes (Re: Safe file update library ready (sort of)): I'm sorry, it might be me, but I fail to see the overlap between the functionalities of safewrite vs. userv. The premises for safewrite is that a program wants to make

Re: Safe file update library ready (sort of)

2011-01-26 Thread Goswin von Brederlow
Shachar Shemesh shac...@debian.org writes: Hi all, I've promised to get a library out there, and here it is. The base URL is https://github.com/Shachar/safewrite, and the actual code is at https://github.com/Shachar/safewrite/blob/master/safewrite.c This is not a formal release just yet

Re: Safe file update library ready (sort of)

2011-01-26 Thread Adam Borowski
On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote: Shachar Shemesh shac...@debian.org writes: I've promised to get a library out there, and here it is. The base URL is https://github.com/Shachar/safewrite, and the actual code is at

Re: Safe file update library ready (sort of)

2011-01-26 Thread Olaf van der Spek
On Wed, Jan 26, 2011 at 12:22 PM, Adam Borowski kilob...@angband.pl wrote: typedef struct {         int fd;         char buffer[PATH_MAX]; } safe_t; Except, you can't rely on PATH_MAX on any modern system.  It's defined in Linux headers to an arbitrary value to make old code compile, but

Re: Safe file update library ready (sort of)

2011-01-26 Thread Olaf van der Spek
On Wed, Jan 26, 2011 at 11:36 AM, Goswin von Brederlow goswin-...@web.de wrote: I think you are dead wrong there Ian. Even if every single program is dead right (and we know a lot aren't) that means every one of them has a safe file update function somewhere in it. A function doing exactly

Re: Safe file update library ready (sort of)

2011-01-26 Thread Goswin von Brederlow
Adam Borowski kilob...@angband.pl writes: On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote: Shachar Shemesh shac...@debian.org writes: I've promised to get a library out there, and here it is. The base URL is https://github.com/Shachar/safewrite, and the actual code is

Re: Safe file update library ready (sort of)

2011-01-26 Thread Hendrik Sattler
Zitat von Goswin von Brederlow goswin-...@web.de: Adam Borowski kilob...@angband.pl writes: On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote: Shachar Shemesh shac...@debian.org writes: I've promised to get a library out there, and here it is. The base URL is

Re: Safe file update library ready (sort of)

2011-01-26 Thread Goswin von Brederlow
Hendrik Sattler p...@hendrik-sattler.de writes: Zitat von Goswin von Brederlow goswin-...@web.de: Adam Borowski kilob...@angband.pl writes: On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote: Shachar Shemesh shac...@debian.org writes: I've promised to get a library out

Re: Safe file update library ready (sort of)

2011-01-26 Thread Olaf van der Spek
On Wed, Jan 26, 2011 at 5:09 PM, Goswin von Brederlow goswin-...@web.de wrote: typedef struct {        int fd;        char buffer[]; } safe_t; or what do you mean by invalid C? Zero length arrays are not valid C AFAIK. -- Olaf -- To UNSUBSCRIBE, email to

Re: Safe file update library ready (sort of)

2011-01-26 Thread Hendrik Sattler
Zitat von Goswin von Brederlow goswin-...@web.de: Hendrik Sattler p...@hendrik-sattler.de writes: Zitat von Goswin von Brederlow goswin-...@web.de: Adam Borowski kilob...@angband.pl writes: On Wed, Jan 26, 2011 at 12:03:52PM +0100, Goswin von Brederlow wrote: Shachar Shemesh

Re: Safe file update library ready (sort of)

2011-01-26 Thread Olaf van der Spek
On Wed, Jan 26, 2011 at 5:36 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: BTW: KDE4 is a very good example for failure with modern filesystems. I regularly loose configuration files when suspend-to-ram fails even if the configuration of the running programs were not changed. Yay :-( And

Re: Safe file update library ready (sort of)

2011-01-26 Thread Hendrik Sattler
Zitat von Olaf van der Spek olafvds...@gmail.com: On Wed, Jan 26, 2011 at 5:36 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: BTW: KDE4 is a very good example for failure with modern filesystems. I regularly loose configuration files when suspend-to-ram fails even if the configuration of

Re: Safe file update library ready (sort of)

2011-01-26 Thread Olaf van der Spek
On Wed, Jan 26, 2011 at 7:25 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: Zitat von Olaf van der Spek olafvds...@gmail.com: On Wed, Jan 26, 2011 at 5:36 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: BTW: KDE4 is a very good example for failure with modern filesystems. I regularly

Re: Safe file update library ready (sort of)

2011-01-04 Thread Shachar Shemesh
On 04/01/11 16:24, Ian Jackson wrote: Shachar Shemesh writes (Safe file update library ready (sort of)): This is not a formal release just yet (plus one function is still missing an implementation, trivial though it might be). It's just that the list obviously has a few people knowledgeable

Re: Safe file update library ready (sort of)

2011-01-04 Thread Ian Jackson
Shachar Shemesh writes (Safe file update library ready (sort of)): This is not a formal release just yet (plus one function is still missing an implementation, trivial though it might be). It's just that the list obviously has a few people knowledgeable on the subject who can give my code a

Re: Safe file update library ready (sort of)

2011-01-04 Thread Ian Jackson
Shachar Shemesh writes (Re: Safe file update library ready (sort of)): I'm sorry, it might be me, but I fail to see the overlap between the functionalities of safewrite vs. userv. The premises for safewrite is that a program wants to make sure data integrity is maintained when writing files

Re: Safe file update library ready (sort of)

2011-01-04 Thread Olaf van der Spek
On Tue, Jan 4, 2011 at 7:19 PM, Ian Jackson ijack...@chiark.greenend.org.uk wrote: Having said that, I don't think the concept behind your library is sound, because it presupposes that all previous programs which update files are buggy. They are. Kinda. They either do unsafe file updates or

Re: Safe file update library ready (sort of)

2011-01-03 Thread Adam Borowski
On Mon, Jan 03, 2011 at 12:43:24PM +0200, Shachar Shemesh wrote: Hi all, I've promised to get a library out there, and here it is. The base URL is https://github.com/Shachar/safewrite, and the actual code is at https://github.com/Shachar/safewrite/blob/master/safewrite.c [...] Give my code

Re: Safe file update library ready (sort of)

2011-01-03 Thread Shachar Shemesh
On 03/01/11 14:10, Adam Borowski wrote: There's a race condition: while [ 1 ]; do ln -s /etc/passwd somefile.tmp; done Hey root, could you please use this program using libsafewrite on 'somefile'? Two questions: 1. Is this race a regression from the single file case? 2. Is this race

Re: Safe file update library ready (sort of)

2011-01-03 Thread Shachar Shemesh
On 03/01/11 14:10, Adam Borowski wrote: There's a race condition: while [ 1 ]; do ln -s /etc/passwd somefile.tmp; done Hey root, could you please use this program using libsafewrite on 'somefile'? Two questions: 1. Is this race a regression from the single file case? 2. Is this race

Re: Safe file update library ready (sort of)

2011-01-03 Thread Michal Čihař
Hi Dne Mon, 03 Jan 2011 15:56:44 +0200 Shachar Shemesh shac...@debian.org napsal(a): In essence, it is impossible, as far as I know (patches welcome) to avoid a race when symlinks are involved (with specific exceptions). The assumption is, and has always been, that the directory resides