You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Evgeny Kotkov via dev <de...@subversion.apache.org> on 2025/12/15 15:31:00 UTC
Re: svn commit: r1915215 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/revert.c svn/notify.c svnbench/notify.c
Daniel Sahlberg <ds...@apache.org> writes:
> svn_boolean_t notify_required;
> + svn_boolean_t notify_noaccess;
…
> if (!metadata_only)
> {
> SVN_ERR(revert_wc_data(run_wq,
> - ¬ify_required,
> + ¬ify_required, ¬ify_noaccess,
> db, local_abspath, status, kind,
> reverted_kind, recorded_size, recorded_time,
> copied_here, use_commit_times,
…
> + if (notify_func)
> + {
> + if (notify_required)
> + notify_func(notify_baton,
> + svn_wc_create_notify(local_abspath, svn_wc_notify_revert,
> + scratch_pool),
> + scratch_pool);
> + else if (notify_noaccess)
> + notify_func(notify_baton,
> + svn_wc_create_notify(local_abspath, svn_wc_notify_revert_noaccess,
> + scratch_pool),
> + scratch_pool);
> + }
It looks like this may have introduced an undefined behavior for reverts with
metadata_only = TRUE.
If metadata_only is TRUE, the block calling revert_wc_data is skipped, meaning
notify_noaccess is never assigned a value. However, the variable might still
be read later in the `else if (notify_noaccess)` check.
Thanks,
Evgeny Kotkov
Re: svn commit: r1915215 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/revert.c svn/notify.c svnbench/notify.c
Posted by Evgeny Kotkov via dev <de...@subversion.apache.org>.
Daniel Sahlberg <da...@gmail.com> writes:
>> If we decide to go this route, I would say it might be better to move the
>> whole topic to 1.16. What are your thoughts on how this fits into the 1.15
>> plan?
>
> I have had another look at it and it is probably better to revert this code
> completely and rework the whole authorization validation. No time to do this
> before 1.15 though so it should be left for 1.16. I have reverted this code.
Thanks!
I understand that reverting isn't the preferred outcome, but it's the right
call in my opinion, and we can have this topic on our radars for 1.16.
Regards,
Evgeny Kotkov
Re: svn commit: r1915215 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/revert.c svn/notify.c svnbench/notify.c
Posted by Daniel Sahlberg <da...@gmail.com>.
Den mån 22 dec. 2025 kl 17:51 skrev Evgeny Kotkov <
evgeny.kotkov@axiorema.com>:
> Daniel Sahlberg <da...@gmail.com> writes:
>
> > Do you agree that it is enough to initialize the variable to FALSE or
> > would you prefer that I rework the whole feature in some way?
>
> Hi Daniel,
>
> After taking a closer look at the whole change, I'm not sure I agree with
> the overall direction of the fix.
>
> As far as I can tell, the issue stems from inconsistencies in the Unix
> implementations of functions like svn_io__is_finfo_read_only() and
> svn_io_set_file_read_write(), such as:
>
> • A file without world write permissions is seen as read-only for root.
> • After calling svn_io_set_file_read_write(TRUE) for such file without an
> error, it is still reported as read-only by svn_io__is_finfo_read_only().
>
> So incorrect notifications are probably just a symptom of a deeper set of
> problems. And these problems may also affect other areas as well, e.g.
> when used by libsvn_fs_fs/rev_file.c:auto_make_writable(). In other words,
> I don't think this is a revert-specific issue; it just happens to be more
> visible there because the notifications are user-facing.
>
> The current change results in a rather verbose notification that may also
> look confusing to the users:
>
> > svn revert -R .
> User doesn't have WRITE permissions to file 'etc/apache2/mods-available/
> dnssd.load' and the file isn't svn:needslock. But the file is already
> writeable. Probably owned by another user.
> User doesn't have WRITE permissions to file 'etc/apache2/mods-available/
> dnssd.conf' and the file isn't svn:needslock. But the file is already
> writeable. Probably owned by another user.
> User doesn't have WRITE permissions to file 'etc/apache2/conf-available/
> javascript-common.conf' and the file isn't svn:needslock. But the file
> is already writeable. Probably owned by another user.
> …
>
> Perhaps, instead of trying to communicate this via the notifications, we
> could
> look into fixing the root cause so that the existing notification logic
> would
> automatically work as intended?
>
> One potential step forward would be to try updating the functions to
> correctly
> work for the `root` user, as mentioned in the original issue report.
> E.g., we
> could create a matrix of permission variations and the expected behavior
> for
> each, and then see if the implementation can be adjusted to match.
>
> If we decide to go this route, I would say it might be better to move the
> whole topic to 1.16. What are your thoughts on how this fits into the 1.15
> plan?
>
I have had another look at it and it is probably better to revert this code
completely and rework the whole authorization validation. No time to do
this before 1.15 though so it should be left for 1.16. I have reverted this
code.
Cheers,
Daniel
Re: svn commit: r1915215 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/revert.c svn/notify.c svnbench/notify.c
Posted by Evgeny Kotkov via dev <de...@subversion.apache.org>.
Daniel Sahlberg <da...@gmail.com> writes:
> Do you agree that it is enough to initialize the variable to FALSE or
> would you prefer that I rework the whole feature in some way?
Hi Daniel,
After taking a closer look at the whole change, I'm not sure I agree with
the overall direction of the fix.
As far as I can tell, the issue stems from inconsistencies in the Unix
implementations of functions like svn_io__is_finfo_read_only() and
svn_io_set_file_read_write(), such as:
• A file without world write permissions is seen as read-only for root.
• After calling svn_io_set_file_read_write(TRUE) for such file without an
error, it is still reported as read-only by svn_io__is_finfo_read_only().
So incorrect notifications are probably just a symptom of a deeper set of
problems. And these problems may also affect other areas as well, e.g.
when used by libsvn_fs_fs/rev_file.c:auto_make_writable(). In other words,
I don't think this is a revert-specific issue; it just happens to be more
visible there because the notifications are user-facing.
The current change results in a rather verbose notification that may also
look confusing to the users:
> svn revert -R .
User doesn't have WRITE permissions to file 'etc/apache2/mods-available/
dnssd.load' and the file isn't svn:needslock. But the file is already
writeable. Probably owned by another user.
User doesn't have WRITE permissions to file 'etc/apache2/mods-available/
dnssd.conf' and the file isn't svn:needslock. But the file is already
writeable. Probably owned by another user.
User doesn't have WRITE permissions to file 'etc/apache2/conf-available/
javascript-common.conf' and the file isn't svn:needslock. But the file
is already writeable. Probably owned by another user.
…
Perhaps, instead of trying to communicate this via the notifications, we could
look into fixing the root cause so that the existing notification logic would
automatically work as intended?
One potential step forward would be to try updating the functions to correctly
work for the `root` user, as mentioned in the original issue report. E.g., we
could create a matrix of permission variations and the expected behavior for
each, and then see if the implementation can be adjusted to match.
If we decide to go this route, I would say it might be better to move the
whole topic to 1.16. What are your thoughts on how this fits into the 1.15
plan?
Thanks,
Evgeny Kotkov
Re: svn commit: r1915215 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/revert.c svn/notify.c svnbench/notify.c
Posted by Daniel Sahlberg <da...@gmail.com>.
Evgeny,
Den mån 15 dec. 2025 kl 22:40 skrev Daniel Sahlberg <
daniel.l.sahlberg@gmail.com>:
...
> [[[
> $ svn diff libsvn_wc/revert.c
> Index: libsvn_wc/revert.c
> ===================================================================
> --- libsvn_wc/revert.c (revision 1930472)
> +++ libsvn_wc/revert.c (working copy)
> @@ -310,7 +310,7 @@
> svn_wc__db_status_t status;
> svn_node_kind_t kind;
> svn_boolean_t notify_required;
> - svn_boolean_t notify_noaccess;
> + svn_boolean_t notify_noaccess = FALSE;
> const apr_array_header_t *conflict_files;
> svn_filesize_t recorded_size;
> apr_time_t recorded_time;
> ]]]
>
Do you agree that it is enough to initialize the variable to FALSE or would
you prefer that I rework the whole feature in some way?
Cheers,
Daniel
Re: svn commit: r1915215 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/revert.c svn/notify.c svnbench/notify.c
Posted by Daniel Sahlberg <da...@gmail.com>.
Den mån 15 dec. 2025 kl 15:32 skrev Evgeny Kotkov via dev <
dev@subversion.apache.org>:
> Daniel Sahlberg <ds...@apache.org> writes:
>
> > svn_boolean_t notify_required;
> > + svn_boolean_t notify_noaccess;
> …
> > if (!metadata_only)
> > {
> > SVN_ERR(revert_wc_data(run_wq,
> > - ¬ify_required,
> > + ¬ify_required, ¬ify_noaccess,
> > db, local_abspath, status, kind,
> > reverted_kind, recorded_size,
> recorded_time,
> > copied_here, use_commit_times,
> …
> > + if (notify_func)
> > + {
> > + if (notify_required)
> > + notify_func(notify_baton,
> > + svn_wc_create_notify(local_abspath,
> svn_wc_notify_revert,
> > + scratch_pool),
> > + scratch_pool);
> > + else if (notify_noaccess)
> > + notify_func(notify_baton,
> > + svn_wc_create_notify(local_abspath,
> svn_wc_notify_revert_noaccess,
> > + scratch_pool),
> > + scratch_pool);
> > + }
>
> It looks like this may have introduced an undefined behavior for reverts
> with
> metadata_only = TRUE.
>
> If metadata_only is TRUE, the block calling revert_wc_data is skipped,
> meaning
> notify_noaccess is never assigned a value. However, the variable might
> still
> be read later in the `else if (notify_noaccess)` check.
>
You are right of course, good catch.
How about:
[[[
$ svn diff libsvn_wc/revert.c
Index: libsvn_wc/revert.c
===================================================================
--- libsvn_wc/revert.c (revision 1930472)
+++ libsvn_wc/revert.c (working copy)
@@ -310,7 +310,7 @@
svn_wc__db_status_t status;
svn_node_kind_t kind;
svn_boolean_t notify_required;
- svn_boolean_t notify_noaccess;
+ svn_boolean_t notify_noaccess = FALSE;
const apr_array_header_t *conflict_files;
svn_filesize_t recorded_size;
apr_time_t recorded_time;
]]]
Cheers,
Daniel
>
>