From: Dan L. <da...@la...> - 2004-09-22 23:42:56
|
On 22 Sep 2004 at 22:27, Kern Sibbald wrote: > When I first wrote Bacula, I wasn't too sure how SQL worked (still have > certain problems), so when it came to empty filenames rather than > dealing with NULLs and other non-compatible horrors of SQL, I simply > created a filename with a single space. It works really nice, except it > isn't too cool if the filename really has a single space. People create empty filenames? How? > Now my question: can I safely create a zero length (non-NULL) string in > all databases so I can get rid of this silly single space kludge and > replace it by a zero length string? > > I could replace it by a NULL, but that requires some special handling. Yes, you could use just an empty string. I see no reason why not. I frequently do that with FreshPorts (on PostgreSQL). -- Dan Langille : http://www.langille.org/ BSDCan - The Technical BSD Conference - http://www.bsdcan.org/ |
From: Kurt J. <kur...@gm...> - 2004-09-23 06:45:57
|
>> People create empty filenames? How? > The "filename" after a directory is totally blank. How about "." (dot) as a new kludge? Last time I checked, "." meant "this directory". However, MySQL and PostGreSQL handle empty strings correctly, NULL means "no string there", and "" means "string of length 0". HTH, Kurt -- +++ GMX DSL Premiumtarife 3 Monate gratis* + WLAN-Router 0,- EUR* +++ Clevere DSL-Nutzer wechseln jetzt zu GMX: http://www.gmx.net/de/go/dsl |
From: Kern S. <ke...@si...> - 2004-09-23 06:54:17
|
On Thu, 2004-09-23 at 08:45, Kurt Jaeke wrote: > >> People create empty filenames? How? > > The "filename" after a directory is totally blank. > How about "." (dot) as a new kludge? Last time I checked, "." meant "this > directory". Thanks, not a bad idea as presumably no file can ever be named ".". However, having kludged once and gotten burned, I'm going for the zero length string approach, which is after all the closest to the "truth" (I think). I've filed this idea away in the back of my head just in case, something like Oracle proves to be really tough ... > > However, MySQL and PostGreSQL handle empty strings correctly, NULL means "no > string there", and "" means "string of length 0". Best regards, Kern |
From: Michael K. J. <joh...@sp...> - 2004-09-23 13:07:38
|
On Thu, Sep 23, 2004 at 08:53:21AM +0200, Kern Sibbald wrote: > On Thu, 2004-09-23 at 08:45, Kurt Jaeke wrote: > > >> People create empty filenames? How? > > > The "filename" after a directory is totally blank. > > How about "." (dot) as a new kludge? Last time I checked, "." meant "this > > directory". > > Thanks, not a bad idea as presumably no file can ever be named ".". > However, having kludged once and gotten burned, I'm going for the zero > length string approach, which is after all the closest to the "truth" (I > think). Actually, since POSIX defines the "." to always be the directory itself, I can't see how it's any more of a kludge than the zero-length string. |
From: Kern S. <ke...@si...> - 2004-09-23 15:00:25
|
On Thu, 2004-09-23 at 15:07, Michael K. Johnson wrote: > On Thu, Sep 23, 2004 at 08:53:21AM +0200, Kern Sibbald wrote: > > On Thu, 2004-09-23 at 08:45, Kurt Jaeke wrote: > > > >> People create empty filenames? How? > > > > The "filename" after a directory is totally blank. > > > How about "." (dot) as a new kludge? Last time I checked, "." meant "this > > > directory". > > > > Thanks, not a bad idea as presumably no file can ever be named ".". > > However, having kludged once and gotten burned, I'm going for the zero > > length string approach, which is after all the closest to the "truth" (I > > think). > > Actually, since POSIX defines the "." to always be the directory itself, > I can't see how it's any more of a kludge than the zero-length string. Yes, you are probably right concerning kludgyness, but since within Bacula, directories and files are treated pretty much the same, where possible, a directory has a empty filename after it. If I use a "." for the empty filename, I'll have to strip it in most occassions because users will not understand that /home/xxx/. is the name of a directory. Regards, Kern > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Bacula-devel mailing list > Bac...@li... > https://lists.sourceforge.net/lists/listinfo/bacula-devel |
From: Matt H. <mh...@ha...> - 2004-09-23 18:23:33
|
Kern Sibbald wrote: > Yes, you are probably right concerning kludgyness, but since within > Bacula, directories and files are treated pretty much the same, where > possible, a directory has a empty filename after it. If I use a "." for > the empty filename, I'll have to strip it in most occassions because > users will not understand that > /home/xxx/. > is the name of a directory. > > Regards, Kern > Not only that, but "." and ".." are both entries in the directory index of /home/xxx, and they can/may be corrupted. Some of the filesystems on Linux automagically point "." to the inode of the directory, while EXT2/3 have a separate entry that can break. I've no idea about such details on the BSDs or other Unixes. "." and ".." are complete magic (discovering where they point to is all in code) on Windows systems; which also have to be considered (unfortunately). -- Matt Howard <mh...@ha...> |
From: Phil S. <al...@ca...> - 2004-09-23 18:33:40
|
On Thu, Sep 23, 2004 at 08:53:21AM +0200, Kern Sibbald wrote: > On Thu, 2004-09-23 at 08:45, Kurt Jaeke wrote: > > >> People create empty filenames? How? > > > The "filename" after a directory is totally blank. > > How about "." (dot) as a new kludge? Last time I checked, "." meant "this > > directory". > > Thanks, not a bad idea as presumably no file can ever be named ".". On the other hand, there is a link named '.' in every directory, referring to the current directory. ...Which, y'know, might not be inappropriate. -- ========== Fight Back! It may not be just YOUR life at risk. ========== al...@ca... : phi...@ea... : ph...@no... phil stracchino : unix ronin : renaissance man : mystic zen biker geek 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold) Linux Now! ...Friends don't let friends use Microsoft. |
From: Kern S. <ke...@si...> - 2004-09-23 05:36:48
|
On Thu, 2004-09-23 at 01:42, Dan Langille wrote: > On 22 Sep 2004 at 22:27, Kern Sibbald wrote: > > > When I first wrote Bacula, I wasn't too sure how SQL worked (still have > > certain problems), so when it came to empty filenames rather than > > dealing with NULLs and other non-compatible horrors of SQL, I simply > > created a filename with a single space. It works really nice, except it > > isn't too cool if the filename really has a single space. > > People create empty filenames? How? The "filename" after a directory is totally blank. > > > Now my question: can I safely create a zero length (non-NULL) string in > > all databases so I can get rid of this silly single space kludge and > > replace it by a zero length string? > > > > I could replace it by a NULL, but that requires some special handling. > > Yes, you could use just an empty string. I see no reason why not. I > frequently do that with FreshPorts (on PostgreSQL). I've made the change, and it seems to work fine. As Meno points out, someday when we have an Oracle driver, it may need to treat empty strings and NULL strings the same, but that is for another time ... |
From: Phil S. <al...@ca...> - 2004-09-23 18:33:39
|
On Thu, Sep 23, 2004 at 07:35:55AM +0200, Kern Sibbald wrote: > On Thu, 2004-09-23 at 01:42, Dan Langille wrote: > > On 22 Sep 2004 at 22:27, Kern Sibbald wrote: > > > > > When I first wrote Bacula, I wasn't too sure how SQL worked (still have > > > certain problems), so when it came to empty filenames rather than > > > dealing with NULLs and other non-compatible horrors of SQL, I simply > > > created a filename with a single space. It works really nice, except it > > > isn't too cool if the filename really has a single space. > > > > People create empty filenames? How? > > The "filename" after a directory is totally blank. > > > > > > Now my question: can I safely create a zero length (non-NULL) string in > > > all databases so I can get rid of this silly single space kludge and > > > replace it by a zero length string? > > > > > > I could replace it by a NULL, but that requires some special handling. > > > > Yes, you could use just an empty string. I see no reason why not. I > > frequently do that with FreshPorts (on PostgreSQL). > > I've made the change, and it seems to work fine. As Meno points out, > someday when we have an Oracle driver, it may need to treat empty > strings and NULL strings the same, but that is for another time ... As another alternative, you might use a special string made up of characters that are illegal in filenames on the various supported platforms, ensuring no legal filename could match it. For instance, I believe neither Mac nor Windows allows a colon to appear in a filename (I know the Mac doesn't, because it uses a colon as the path separator, and I think Windows doesn't either). Of course, this is going to be a little difficult on Unix, because almost any character is legal in a Unix filename if escaped. I'm not sure I know of any character which MAY NOT, period, be used in a Unix filename. -- ========== Fight Back! It may not be just YOUR life at risk. ========== al...@ca... : phi...@ea... : ph...@no... phil stracchino : unix ronin : renaissance man : mystic zen biker geek 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold) Linux Now! ...Friends don't let friends use Microsoft. |
From: Kern S. <ke...@si...> - 2004-09-23 18:50:43
|
Thanks for all the ideas. For the moment, I have "solved" the problem (hopefully permanently) by making the filename the empty string. I think we can make Bacula deal with Oracle's oddities when the time comes. Regards, Kern On Thu, 2004-09-23 at 18:22, Phil Stracchino wrote: > On Thu, Sep 23, 2004 at 07:35:55AM +0200, Kern Sibbald wrote: > > On Thu, 2004-09-23 at 01:42, Dan Langille wrote: > > > On 22 Sep 2004 at 22:27, Kern Sibbald wrote: > > > > > > > When I first wrote Bacula, I wasn't too sure how SQL worked (still have > > > > certain problems), so when it came to empty filenames rather than > > > > dealing with NULLs and other non-compatible horrors of SQL, I simply > > > > created a filename with a single space. It works really nice, except it > > > > isn't too cool if the filename really has a single space. > > > > > > People create empty filenames? How? > > > > The "filename" after a directory is totally blank. > > > > > > > > > Now my question: can I safely create a zero length (non-NULL) string in > > > > all databases so I can get rid of this silly single space kludge and > > > > replace it by a zero length string? > > > > > > > > I could replace it by a NULL, but that requires some special handling. > > > > > > Yes, you could use just an empty string. I see no reason why not. I > > > frequently do that with FreshPorts (on PostgreSQL). > > > > I've made the change, and it seems to work fine. As Meno points out, > > someday when we have an Oracle driver, it may need to treat empty > > strings and NULL strings the same, but that is for another time ... > > > As another alternative, you might use a special string made up of > characters that are illegal in filenames on the various supported > platforms, ensuring no legal filename could match it. For instance, I > believe neither Mac nor Windows allows a colon to appear in a filename > (I know the Mac doesn't, because it uses a colon as the path separator, > and I think Windows doesn't either). > > Of course, this is going to be a little difficult on Unix, because > almost any character is legal in a Unix filename if escaped. I'm not > sure I know of any character which MAY NOT, period, be used in a Unix > filename. > |
From: Michael K. J. <joh...@sp...> - 2004-09-23 19:22:22
|
On Thu, Sep 23, 2004 at 12:22:28PM -0400, Phil Stracchino wrote: > Of course, this is going to be a little difficult on Unix, because > almost any character is legal in a Unix filename if escaped. I'm not > sure I know of any character which MAY NOT, period, be used in a Unix > filename. The only illegal filename character on Unix is the "/". Well, and \0 -- which is implied because the C string is defined to end with a \0 character, and the base ABI for dealing with these strings is the C API. It has nothing to do with escaping any characters. The filesystem doesn't have the concept of escaping a character. That's a shell contruct only, which is only related to the filenames in that filenames sometimes show up as arguments passed to programs, and that shells tend to have filename globbing functions. (You probably knew that, but I figured I'd make sure to clarify anyway. :-) |
From: Phil S. <al...@ca...> - 2004-09-23 22:02:14
|
On Thu, Sep 23, 2004 at 03:22:10PM -0400, Michael K. Johnson wrote: > On Thu, Sep 23, 2004 at 12:22:28PM -0400, Phil Stracchino wrote: > > Of course, this is going to be a little difficult on Unix, because > > almost any character is legal in a Unix filename if escaped. I'm not > > sure I know of any character which MAY NOT, period, be used in a Unix > > filename. > > The only illegal filename character on Unix is the "/". Well, and > \0 -- which is implied because the C string is defined to end with > a \0 character, and the base ABI for dealing with these strings is > the C API. > > It has nothing to do with escaping any characters. The filesystem > doesn't have the concept of escaping a character. That's a shell > contruct only, which is only related to the filenames in that filenames > sometimes show up as arguments passed to programs, and that shells > tend to have filename globbing functions. > > (You probably knew that, but I figured I'd make sure to clarify > anyway. :-) Well, yeah. :) So, if one was to go that route, the string '/:\' would be an illegal filename on Mac, Windows, and Unix. (And VMS, I think....? My memories of VMS are hazy.) -- ========== Fight Back! It may not be just YOUR life at risk. ========== al...@ca... : phi...@ea... : ph...@no... phil stracchino : unix ronin : renaissance man : mystic zen biker geek 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold) Linux Now! ...Friends don't let friends use Microsoft. |