@@ -135,7 +135,7 @@ static void create_dirs( const char *path )
135135 * whole tree.
136136 *
137137 */
138- static void traverse_dir (void **state, const QString &dir, int *cnt)
138+ static void traverse_dir (void **state, const QString &dir, int *cnt, bool checkPermissionsValidity )
139139{
140140 csync_vio_handle_t *dh = nullptr ;
141141 std::unique_ptr<csync_file_stat_t > dirent;
@@ -149,7 +149,7 @@ static void traverse_dir(void **state, const QString &dir, int *cnt)
149149 assert_non_null (dh);
150150
151151 OCC::Vfs *vfs = nullptr ;
152- while ( (dirent = csync_vio_local_readdir (dh, vfs)) ) {
152+ while ( (dirent = csync_vio_local_readdir (dh, vfs, checkPermissionsValidity )) ) {
153153 assert_non_null (dirent.get ());
154154 if (!dirent->original_path .isEmpty ()) {
155155 sv->ignored_dir = dirent->original_path ;
@@ -178,7 +178,7 @@ static void traverse_dir(void **state, const QString &dir, int *cnt)
178178 }
179179 output (subdir_out.constData ());
180180 if ( is_dir ) {
181- traverse_dir (state, QString::fromUtf8 (subdir), cnt);
181+ traverse_dir (state, QString::fromUtf8 (subdir), cnt, checkPermissionsValidity );
182182 }
183183 }
184184
@@ -198,11 +198,12 @@ static void check_readdir_shorttree(void **state)
198198{
199199 auto sv = (statevar*) *state;
200200
201+ bool checkPermissionsValidity = true ;
201202 const char *t1 = " alibaba/und/die/vierzig/räuber/" ;
202203 create_dirs ( t1 );
203204 int files_cnt = 0 ;
204205
205- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
206+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
206207
207208 assert_string_equal (sv->result .constData (),
208209 QString::fromUtf8 (" <DIR> %1/alibaba"
@@ -221,14 +222,15 @@ static void check_readdir_with_content(void **state)
221222 auto sv = (statevar*) *state;
222223 int files_cnt = 0 ;
223224
225+ bool checkPermissionsValidity = true ;
224226 const char *t1 = " warum/nur/40/Räuber/" ;
225227 create_dirs ( t1 );
226228
227229 create_file ( t1, " Räuber Max.txt" , " Der Max ist ein schlimmer finger" );
228230 create_file ( t1, " пя́тница.txt" , " Am Freitag tanzt der Ürk" );
229231
230232
231- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
233+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
232234
233235 assert_string_equal (sv->result .constData (),
234236 QString::fromUtf8 (" <DIR> %1/warum"
@@ -247,6 +249,8 @@ static void check_readdir_longtree(void **state)
247249{
248250 auto sv = (statevar*) *state;
249251
252+ bool checkPermissionsValidity = true ;
253+
250254 /* Strange things here: Compilers only support strings with length of 4k max.
251255 * The expected result string is longer, so it needs to be split up in r1, r2 and r3
252256 */
@@ -306,7 +310,7 @@ static void check_readdir_longtree(void **state)
306310 /* assemble the result string ... */
307311 const auto result = (r1 + r2 + r3).toUtf8 ();
308312 int files_cnt = 0 ;
309- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
313+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
310314 assert_int_equal (files_cnt, 0 );
311315 /* and compare. */
312316 assert_string_equal (sv->result .constData (), result.constData ());
@@ -321,6 +325,7 @@ static void check_readdir_bigunicode(void **state)
321325// 3: ? ASCII: 191 - BF
322326// 4: ASCII: 32 - 20
323327
328+ bool checkPermissionsValidity = true ;
324329 QString p = QStringLiteral (" %1/%2" ).arg (CSYNC_TEST_DIR, QStringLiteral (" goodone/" ));
325330 int rc = oc_mkdir (p);
326331 assert_int_equal (rc, 0 );
@@ -332,7 +337,7 @@ static void check_readdir_bigunicode(void **state)
332337 assert_int_equal (rc, 0 );
333338
334339 int files_cnt = 0 ;
335- traverse_dir (state, CSYNC_TEST_DIR, &files_cnt);
340+ traverse_dir (state, CSYNC_TEST_DIR, &files_cnt, checkPermissionsValidity );
336341 const auto expected_result = QStringLiteral (" <DIR> %1/goodone"
337342 " <DIR> %1/goodone/ugly\xEF\xBB\xBF\x32 .txt" )
338343 .arg (CSYNC_TEST_DIR);
0 commit comments