Re: How to open specified inside .svn
On 01.03.2019 04:58, wuzhouhui wrote: >> -Original Messages- >> From: "Ralph Seichter" >> Sent Time: 2019-03-01 11:46:52 (Friday) >> To: users@subversion.apache.org >> Cc: >> Subject: Re: How to open specified inside .svn >> >> * wuzhouhui: >> >>> Could someone remind me that which function can be used to open >>> .svn/Adir/Afile in client? >> I'm not sure I understand what you are trying to achieve? The .svn >> directories (and contents) should not be accessed directly. That's what >> the SVN client is for. > I want svn to support working copy hooks (just for my own use), so I want > svn to execute .svn/hooks/pre-commit if possible. I want to know which > functions can be used to open and execute .svn/hooks/pre-commit. There are no such generic functions. The svn_wc API isn't really meant to be public, so you'll have to write your own access functions. Look at how the svn_client implementations do it, or for example svn_wc__get_pristine_contents_by_checksum in svn_wc_private.h. -- Brane
Re: Re: How to open specified inside .svn
> -Original Messages- > From: "Branko Čibej" > Sent Time: 2019-03-01 17:16:40 (Friday) > To: users@subversion.apache.org > Cc: > Subject: Re: How to open specified inside .svn > > On 01.03.2019 04:58, wuzhouhui wrote: > >> -Original Messages- > >> From: "Ralph Seichter" > >> Sent Time: 2019-03-01 11:46:52 (Friday) > >> To: users@subversion.apache.org > >> Cc: > >> Subject: Re: How to open specified inside .svn > >> > >> * wuzhouhui: > >> > >>> Could someone remind me that which function can be used to open > >>> .svn/Adir/Afile in client? > >> I'm not sure I understand what you are trying to achieve? The .svn > >> directories (and contents) should not be accessed directly. That's what > >> the SVN client is for. > > I want svn to support working copy hooks (just for my own use), so I want > > svn to execute .svn/hooks/pre-commit if possible. I want to know which > > functions can be used to open and execute .svn/hooks/pre-commit. > > > There are no such generic functions. The svn_wc API isn't really meant > to be public, so you'll have to write your own access functions. Look at > how the svn_client implementations do it, or for example > svn_wc__get_pristine_contents_by_checksum in svn_wc_private.h. Actually, I'm hacking Subversion client command line tool, so it doesn't matter whether the API is public or private. I will check how svn open files within .svn (e.g. wc.db or wc.db-journal), and learn from them. Thanks. > > -- Brane
Replacing directory by circular symlink produces malformed XML
Hello, The situation of the replacement of a directory by a circular symlink generates an XML fragment which is invalid, hence triggers a failure within the calling system. See hereafter the recipe. Starting from a clean folder, do the following: % svn mkdir 1 A 1 % rmdir 1 % ln -s 1 1 % touch 2 % svn status --xml svn: E62: Can't open directory '/Users/dexco/svntest/svn/1': Too many levels of symbolic links % There is a missing end tag for and . Another issue is missing output: path '2' is not listed. The correction of these issues will be much appreciated (i use 1.11.1). Regards, Denis Excoffier.
Re: Replacing directory by circular symlink produces malformed XML
On 28.02.2019 22:44, Denis Excoffier wrote: > Hello, > > The situation of the replacement of a directory by a circular symlink > generates an XML fragment which is invalid, hence triggers a failure > within the calling system. See hereafter the recipe. > > Starting from a clean folder, do the following: > > % svn mkdir 1 > A 1 > % rmdir 1 > % ln -s 1 1 > % touch 2 > % svn status --xml > > > path="."> > path="1"> > item="obstructed" >revision="-1" >props="none"> > > > svn: E62: Can't open directory '/Users/dexco/svntest/svn/1': Too many > levels of symbolic links > % > > There is a missing end tag for and . > Another issue is missing output: path '2' is not listed. > > The correction of these issues will be much appreciated (i use 1.11.1). You can't expect valid output from a command that fails. I'd have thought that was obvious? -- Brane
Re: Replacing directory by circular symlink produces malformed XML
On Thu, Feb 28, 2019 at 10:44:25PM +0100, Denis Excoffier wrote: > Hello, > > The situation of the replacement of a directory by a circular symlink > generates an XML fragment which is invalid, hence triggers a failure > within the calling system. See hereafter the recipe. > > Starting from a clean folder, do the following: > > % svn mkdir 1 > A 1 > % rmdir 1 > % ln -s 1 1 > % touch 2 > % svn status --xml > > > path="."> > path="1"> > item="obstructed" >revision="-1" >props="none"> > > > svn: E62: Can't open directory '/Users/dexco/svntest/svn/1': Too many > levels of symbolic links > % > > There is a missing end tag for and . > Another issue is missing output: path '2' is not listed. > > The correction of these issues will be much appreciated (i use 1.11.1). > > Regards, > > Denis Excoffier. Hi Denis, This problem is not specific to symbolic links. There are quite a few cases where --xml produces invalid XML when it runs into some kind of error. Perhaps the command line client should be fixed to close open XML tags when an error occurs, though this also risks people or scripts not noticing such errors. I suppose that, ideally, our XML output would embed errors inside the XML stream in a well-defined manner, as well as printing errors on stderr. So fixing this would require some non-trivial amount of effort. Would you have time and skills to work on this issue? Thanks, Stefan
Re: Replacing directory by circular symlink produces malformed XML
On 01.03.2019 11:53, Stefan Sperling wrote: > On Thu, Feb 28, 2019 at 10:44:25PM +0100, Denis Excoffier wrote: >> Hello, >> >> The situation of the replacement of a directory by a circular symlink >> generates an XML fragment which is invalid, hence triggers a failure >> within the calling system. See hereafter the recipe. >> >> Starting from a clean folder, do the following: >> >> % svn mkdir 1 >> A 1 >> % rmdir 1 >> % ln -s 1 1 >> % touch 2 >> % svn status --xml >> >> >> >path="."> >> >path="1"> >> >item="obstructed" >>revision="-1" >>props="none"> >> >> >> svn: E62: Can't open directory '/Users/dexco/svntest/svn/1': Too many >> levels of symbolic links >> % >> >> There is a missing end tag for and . >> Another issue is missing output: path '2' is not listed. >> >> The correction of these issues will be much appreciated (i use 1.11.1). >> >> Regards, >> >> Denis Excoffier. > Hi Denis, > > This problem is not specific to symbolic links. > There are quite a few cases where --xml produces invalid XML > when it runs into some kind of error. Perhaps the command > line client should be fixed to close open XML tags when an > error occurs, though this also risks people or scripts not > noticing such errors. > > I suppose that, ideally, our XML output would embed errors > inside the XML stream in a well-defined manner, as well as > printing errors on stderr. > > So fixing this would require some non-trivial amount of effort. > Would you have time and skills to work on this issue? My advice is to leave well enough alone. Any callers of our tools _should_ check the exit code before assuming that the output is valid. Just streaming the output through a SAX parser isn't the best strategy. -- Brane
Re: Re: How to open specified inside .svn
wuzhouhui wrote on Fri, Mar 01, 2019 at 17:46:55 +0800: > > -Original Messages- > > From: "Branko Čibej" > > Sent Time: 2019-03-01 17:16:40 (Friday) > > To: users@subversion.apache.org > > Cc: > > Subject: Re: How to open specified inside .svn > > > > There are no such generic functions. The svn_wc API isn't really meant > > to be public, so you'll have to write your own access functions. Look at > > how the svn_client implementations do it, or for example > > svn_wc__get_pristine_contents_by_checksum in svn_wc_private.h. > > Actually, I'm hacking Subversion client command line tool, so it > doesn't matter whether the API is public or private. The difference isn't just visibility. We don't promise compatibility for private APIs, not even across patch releases in the same minor line (1.A.x and 1.A.y).
Re: Replacing directory by circular symlink produces malformed XML
Branko Čibej wrote on Fri, Mar 01, 2019 at 12:08:41 +0100: > On 01.03.2019 11:53, Stefan Sperling wrote: > > On Thu, Feb 28, 2019 at 10:44:25PM +0100, Denis Excoffier wrote: > >> Hello, > >> > >> The situation of the replacement of a directory by a circular symlink > >> generates an XML fragment which is invalid, hence triggers a failure > >> within the calling system. See hereafter the recipe. > >> > >> Starting from a clean folder, do the following: > >> > >> % svn mkdir 1 > >> A 1 > >> % rmdir 1 > >> % ln -s 1 1 > >> % touch 2 > >> % svn status --xml > >> > >> > >> >>path="."> > >> >>path="1"> > >> >>item="obstructed" > >>revision="-1" > >>props="none"> > >> > >> > >> svn: E62: Can't open directory '/Users/dexco/svntest/svn/1': Too many > >> levels of symbolic links > >> % > >> > >> There is a missing end tag for and . > >> Another issue is missing output: path '2' is not listed. > >> > >> The correction of these issues will be much appreciated (i use 1.11.1). > >> > >> Regards, > >> > >> Denis Excoffier. > > Hi Denis, > > > > This problem is not specific to symbolic links. > > There are quite a few cases where --xml produces invalid XML > > when it runs into some kind of error. Perhaps the command > > line client should be fixed to close open XML tags when an > > error occurs, though this also risks people or scripts not > > noticing such errors. > > > > I suppose that, ideally, our XML output would embed errors > > inside the XML stream in a well-defined manner, as well as > > printing errors on stderr. > > > > So fixing this would require some non-trivial amount of effort. > > Would you have time and skills to work on this issue? > > My advice is to leave well enough alone. Any callers of our tools > _should_ check the exit code before assuming that the output is valid. > Just streaming the output through a SAX parser isn't the best strategy. But there could have been tens of modified or unversioned s before the circular symlink. The size of output is O(N) where N is the number of interesting items found in the wc walk (= the number of lines in the non-XML `svn st` output). Internally we always process trees streamily; shouldn't we assume API consumers process trees streamily too? Secondly, I don't understand why there's an error at all. Shouldn't it just report an obstruction (dirent's svn_kind_t value changed) and move on? Cheers, Daniel
Re: How to open specified inside .svn
> On Mar 2, 2019, at 8:21 AM, Daniel Shahaf wrote: > > wuzhouhui wrote on Fri, Mar 01, 2019 at 17:46:55 +0800: >>> -Original Messages- >>> From: "Branko Čibej" >>> Sent Time: 2019-03-01 17:16:40 (Friday) >>> To: users@subversion.apache.org >>> Cc: >>> Subject: Re: How to open specified inside .svn >>> >>> There are no such generic functions. The svn_wc API isn't really meant >>> to be public, so you'll have to write your own access functions. Look at >>> how the svn_client implementations do it, or for example >>> svn_wc__get_pristine_contents_by_checksum in svn_wc_private.h. >> >> Actually, I'm hacking Subversion client command line tool, so it >> doesn't matter whether the API is public or private. > > The difference isn't just visibility. We don't promise compatibility > for private APIs, not even across patch releases in the same minor line > (1.A.x and 1.A.y). Thanks for your reminding. I have implement client side pre-commit hook. The implementation maybe ugly, but it works at least. In case of someone have interests, you can find my customized Subversion in https://github.com/wuzhouhui/subversion. Please forgive me about using Git to version control Subversion :-)