rhuij...@apache.org wrote on Fri, Jul 01, 2011 at 20:42:37 -0000:
> Author: rhuijben
> Date: Fri Jul  1 20:42:36 2011
> New Revision: 1142088
> 
> URL: http://svn.apache.org/viewvc?rev=1142088&view=rev
> Log:
> When renaming a file in run_file_install() fails check if this might be caused
> by a missing parent directory.
> 
> * subversion/libsvn_wc/workqueue.c
>   (run_file_install): Try to create missing parent directories if we fail here
>     because the target directory is not present.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_wc/workqueue.c
> 
> Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
> URL: 
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1142088&r1=1142087&r2=1142088&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/workqueue.c Fri Jul  1 20:42:36 2011
> @@ -737,7 +737,33 @@ run_file_install(svn_wc__db_t *db,
>  
>    /* All done. Move the file into place.  */
>    /* ### fix this. we should delay the rename.  */
> -  SVN_ERR(svn_io_file_rename(dst_abspath, local_abspath, scratch_pool));
> +
> +  {
> +    svn_error_t *err;
> +
> +    err = svn_io_file_rename(dst_abspath, local_abspath, scratch_pool);
> +
> +    /* With a single db we might want to install files in a missing 
> directory.
> +       Simply trying this scenario on error won't do any harm and at least
> +       one user reported this problem on IRC. */

>From IRC:


23:34:08      @danielsh | svn ps svn:externals 
'^/subversion/trunk/notes/ssh-tricks tricks notes';
                          svn up notes; svn up -r0 | notes # treeconflict; rm 
-f notes;
                          $svn resolved notes; $svn up notes # wantscleanup; 
$svn cleanup

23:44:34          @Bert | danielsh: I think we should one of those repros to 
the test suite.





> +    if (err && APR_STATUS_IS_ENOENT(err->apr_err))
> +      {
> +        svn_error_t *err2;
> +
> +        err2 = svn_io_make_dir_recursively(svn_dirent_dirname(dst_abspath,
> +                                                              scratch_pool),
> +                                           scratch_pool);
> +      
> +        if (err2)
> +          /* Creating directory didn't work: Return all errors */
> +          return svn_error_trace(svn_error_compose_create(err, err2));
> +        else
> +          /* We could create a directory: retry install */
> +          svn_error_clear(err);
> +      
> +        SVN_ERR(svn_io_file_rename(dst_abspath, local_abspath, 
> scratch_pool));
> +      }
> +  }
>  
>    /* Tweak the on-disk file according to its properties.  */
>    if (props
> 
> 

Reply via email to