You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/07/01 22:42:37 UTC

svn commit: r1142088 - /subversion/trunk/subversion/libsvn_wc/workqueue.c

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. */
+    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



Re: svn commit: r1142088 - /subversion/trunk/subversion/libsvn_wc/workqueue.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Daniel Shahaf wrote on Fri, Jul 01, 2011 at 23:46:54 +0300:
> rhuijben@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
> 

After this revision, the same recipe produces:

[[[
...
% $svn resolved notes/commit-access-templates/
Resolved conflicted state of 'notes/commit-access-templates'
% $svn up notes/commit-access-templates/
Updating 'notes/commit-access-templates':
   C notes/commit-access-templates
   A notes/commit-access-templates/pmc-member.tmpl
   A notes/commit-access-templates/partial-committer.tmpl
   A notes/commit-access-templates/contrib-committer.tmpl
   A notes/commit-access-templates/full-committer.tmpl

Fetching external item into 'notes/commit-access-templates/contrib':
svn: warning: W000002: Can't move '/home/daniel/src/svn/t1/.svn/tmp/svn-sJC3MU' to '/home/daniel/src/svn/t1/notes/commit-access-templates/contrib': No such file or directory

Updated to revision 1142092.
Summary of conflicts:
  Tree conflicts: 1
subversion/svn/update-cmd.c:176: (apr_err=205011)
svn: E205011: Failure occurred processing one or more externals definitions
zsh: exit 1     $SVN up notes/commit-access-templates/
% file notes/commit-access-templates/
notes/commit-access-templates: ERROR: cannot open `notes/commit-access-templates' (No such file or directory)
zsh: exit 1     file notes/commit-access-templates
]]]

Re: svn commit: r1142088 - /subversion/trunk/subversion/libsvn_wc/workqueue.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Daniel Shahaf wrote on Fri, Jul 01, 2011 at 23:46:54 +0300:
> rhuijben@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
> 

After this revision, the same recipe produces:

[[[
...
% $svn resolved notes/commit-access-templates/
Resolved conflicted state of 'notes/commit-access-templates'
% $svn up notes/commit-access-templates/
Updating 'notes/commit-access-templates':
   C notes/commit-access-templates
   A notes/commit-access-templates/pmc-member.tmpl
   A notes/commit-access-templates/partial-committer.tmpl
   A notes/commit-access-templates/contrib-committer.tmpl
   A notes/commit-access-templates/full-committer.tmpl

Fetching external item into 'notes/commit-access-templates/contrib':
svn: warning: W000002: Can't move '/home/daniel/src/svn/t1/.svn/tmp/svn-sJC3MU' to '/home/daniel/src/svn/t1/notes/commit-access-templates/contrib': No such file or directory

Updated to revision 1142092.
Summary of conflicts:
  Tree conflicts: 1
subversion/svn/update-cmd.c:176: (apr_err=205011)
svn: E205011: Failure occurred processing one or more externals definitions
zsh: exit 1     $SVN up notes/commit-access-templates/
% file notes/commit-access-templates/
notes/commit-access-templates: ERROR: cannot open `notes/commit-access-templates' (No such file or directory)
zsh: exit 1     file notes/commit-access-templates
]]]

Re: svn commit: r1142088 - /subversion/trunk/subversion/libsvn_wc/workqueue.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
rhuijben@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
> 
> 

Re: svn commit: r1142088 - /subversion/trunk/subversion/libsvn_wc/workqueue.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
rhuijben@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
> 
>