Re: [PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-06 Thread Sergey Raevskiy
> I committed the test using /bin/sh, anything else is a lot more work and > possibly more likely to fail than to find a system without /bin/sh. I'm agree, other options seems to be less reliable and much more complicated. Finally, there is well-known practise of using /usr/bin/env (e.g. '#!/usr/

Re: [PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-06 Thread Philip Martin
Branko Čibej writes: >> I would expect this to work in practice as I've never seen a Unix >> machine without /bin/sh, but I suppose strictly speaking we cannot rely >> on /bin/sh. Is it portable enough? I suppose we could have a configure >> variable based on CONFIG_SHELL. Or have a configure

Re: [PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-06 Thread Branko Čibej
On 06.02.2015 17:14, Philip Martin wrote: > Sergey Raevskiy writes: > >> + /* Set an empty pre-commit hook. */ >> +#ifdef WIN32 >> + SVN_ERR(svn_io_file_create( >> + "test-repo-deprecated-access-context-api/hooks/pre-commit.bat", >> + "exit 0" APR_EOL_STR, pool)); >> +#else >> + SVN_E

Re: [PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-06 Thread Philip Martin
Sergey Raevskiy writes: > + /* Set an empty pre-commit hook. */ > +#ifdef WIN32 > + SVN_ERR(svn_io_file_create( > + "test-repo-deprecated-access-context-api/hooks/pre-commit.bat", > + "exit 0" APR_EOL_STR, pool)); > +#else > + SVN_ERR(svn_io_file_create( > + "test-repo-deprecate

Re: [PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-06 Thread Sergey Raevskiy
Thanks for the review! I really messed up the test. > How is that going to work? "exit 0" is not a valid hook script. It > might work with an additional "/bin/sh" but that is not portable. This will actually work on Windows, but yes, it isn't portable. > Ah! The fs layer does not run any hoo

Re: [PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-06 Thread Philip Martin
Sergey Raevskiy writes: > +static svn_error_t * > +pre_commit_hook_lock_token_without_path(const svn_test_opts_t *opts, > +apr_pool_t *pool) > +{ > + svn_repos_t *repos; > + svn_fs_access_t *access; > + svn_fs_txn_t *txn; > + svn_fs_root_t *root; > + c

Re: [PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-06 Thread Philip Martin
Sergey Raevskiy writes: > I've attached the patch with crashing test and simple fix, but I'm not really > sure about my solution. A probably better approach would be to replace magic > pointer value by an empty string, but I'm not sure about binary compatibility > etc. The empty string is a val

[PATCH] Fix potential crash in libsvn_repos when executing pre-commit hook

2015-02-05 Thread Sergey Raevskiy
Hi! I've discovered another crash in lock-related code. Usage of deprecated API svn_fs_access_add_lock_token() function leads to crash when pre-commit hook is getting executed. Function svn_fs_access_add_lock_token() simply calls svn_fs_access_add_lock_token2() and passes some magic value ((cons