Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r2469 - branches/fsvs-1.2.x/fsvs: . src

fsvs
Discussion topic

Back to topic list

svn commit: r2469 - branches/fsvs-1.2.x/fsvs: . src

Author pmarek
Full name P.Marek
Date 2013-05-31 17:28:33 PDT
Message Author: pmarek
Date: 2013-05-30 22:40:12-0700
New Revision: 2469

Modified:
   branches/fsvs-1.2.x/​fsvs/CHANGES
   branches/fsvs-1.2.x/​fsvs/src/update.c

Log:
Trying to fix a segfault on deleted properties.

Modified: branches/fsvs-1.2.x/​fsvs/CHANGES
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/CHANGES?view=​diff&pathrev=246​9&r1=2468&r2​=2469
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/CHANGES (original)
+++ branches/fsvs-1.2.x/​fsvs/CHANGES 2013-05-30 22:40:12-0700
@@ -1,4 +1,5 @@
 Changes since 1.2.5
+- Fix for segfault on deleted properties, eg. "svn:owner".
 - configure.in fix for OS X Lion with clang; thanks, Ryan!
   http://fsvs.tigris.o​rg/issues/show_bug.c​gi?id=16
 - Removed nested functions, to make the stack non-executable

Modified: branches/fsvs-1.2.x/​fsvs/src/update.c
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/src/update.c?​view=diff&pathre​v=2469&r1=2468​&r2=2469
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/src/update.c (original)
+++ branches/fsvs-1.2.x/​fsvs/src/update.c 2013-05-30 22:40:12-0700
@@ -166,6 +166,12 @@
     status=0;
     if (!utf8_value)
     {
+ /* A NULL here means that the property got deleted.
+ * That mostly means that we cannot say whether the user
+ * or group changed - the best we can do is not to crash.
+ * Well, one case is special - if it's the propname_special
+ * flag... */
+
         DEBUGP("got NULL property for %s: %s", sts->name, loc_name);
         //goto ex;
         loc_value=NULL;
@@ -180,6 +186,37 @@
 
     /* if an invalid utf8_value is detected, we'd better ignore it.
      * who knows which Pandora's box we'd open ... */
+ if (0 == strcmp(utf8_name, propname_special) &&
+ 0 == strcmp(utf8_value->data, propval_special))
+ {
+ if (!utf8_value) {
+ sts->st.mode = (sts->st.mode & ~S_IFMT) | S_IFREG;
+ DEBUGP("no longer special");
+ }
+ else if (TEST_PACKED(S_ISANYSPECIAL, sts->new_rev_mode_packed))
+ {
+ DEBUGP("already marked as special");
+ }
+ else
+ {
+ /* Remove any S_IFDIR and similar bits, if it is not already marked
+ * as a special entry. */
+ if (!(S_ISLNK(PACKED_to​_MODE_T(sts->new_​rev_mode_packed)) ||
+ S_ISCHR(PACKED_to_MO​DE_T(sts->new_rev​_mode_packed)) ||
+ S_ISBLK(PACKED_to_MO​DE_T(sts->new_rev​_mode_packed))) )
+ {
+ sts->st.mode = (sts->st.mode & ~S_IFMT) | S_IFANYSPECIAL;
+ sts->new_rev_mode_packed = MODE_T_to_PACKED(sts​->st.mode);
+ }
+ DEBUGP("this is a special node");
+ }
+
+ goto ex;
+ }
+
+ if (!utf8_value)
+ goto ex;
+
     if (0 == strcmp(utf8_name, propname_owner))
     {
         /* for user and group we try to find the user name, and fall back
@@ -297,27 +334,6 @@
             }
         }
     }
- else if (0 == strcmp(utf8_name, propname_special) &&
- 0 == strcmp(utf8_value->data, propval_special))
- {
- if (TEST_PACKED(S_ISANYSPECIAL, sts->new_rev_mode_packed))
- {
- DEBUGP("already marked as special");
- }
- else
- {
- /* Remove any S_IFDIR and similar bits, if it is not already marked
- * as a special entry. */
- if (!(S_ISLNK(PACKED_to​_MODE_T(sts->new_​rev_mode_packed)) ||
- S_ISCHR(PACKED_to_MO​DE_T(sts->new_rev​_mode_packed)) ||
- S_ISBLK(PACKED_to_MO​DE_T(sts->new_rev​_mode_packed))) )
- {
- sts->st.mode = (sts->st.mode & ~S_IFMT) | S_IFANYSPECIAL;
- sts->new_rev_mode_packed = MODE_T_to_PACKED(sts​->st.mode);
- }
- DEBUGP("this is a special node");
- }
- }
     else if (0 == strcmp(utf8_name, propname_origmd5))
     {
         /* Depending on the order of the properties we might not know whether

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r2469 - branches/fsvs-1.2.x/fsvs: . src pmarek P.Marek 2013-05-31 17:28:33 PDT
Messages per page: