File indexing completed on 2024-05-12 04:22:23
0001 # SPDX-FileCopyrightText: 2020 Johannes Zarl-Zierl <johannes@zarl-zierl.at> 0002 # SPDX-FileCopyrightText: 2021 Johannes Zarl-Zierl <johannes@zarl-zierl.at> 0003 # 0004 # SPDX-License-Identifier: BSD-2-Clause 0005 0006 _checks[check_recover-from-idzero]="Recovery from tags with id=0" 0007 _context[check_recover-from-idzero]="<h2>What this test will do:</h2> 0008 <p><ul> 0009 <li>This test checks whether a database file with tags with id=0 is read correctly.<br/> 0010 For a detailed analysis on how this kind of database inconsistency could occur, see <a href='https://bugs.kde.org/show_bug.cgi?id=415415'>bug #415415</a> 0011 </li> 0012 <li>After you close this dialog, KPhotoAlbum will be started 2 times in a row.</li> 0013 </ul> 0014 </p> 0015 <h2>What you have to do:</h2> 0016 <ol> 0017 <li>Each time KPhotoAlbum starts, save the database and exit KPhotoAlbum.</li> 0018 </ol>" 0019 check_recover-from-idzero() 0020 { 0021 local check_name="check_recover-from-idzero" 0022 local check_dir="$TEMPDIR/$check_name" 0023 local data_dir="$mydir/db/recover-from-idzero" 0024 setup_check "$check_dir" || return $result_err_setup 0025 # not needed in this scenario: 0026 rm -r "$check_dir/db" 0027 0028 kdialog --msgbox "<h1>$check_name</h1>${_context[$check_name]}" 0029 0030 for subcheck in compressed uncompressed 0031 do 0032 local subcheck_dir="$check_dir/$subcheck" 0033 mkdir "$subcheck_dir" || return $result_err_setup 0034 0035 local add_rc="[General]\nuntaggedCategory=\nuntaggedTag=\n" 0036 if [[ "$subcheck" == "uncompressed" ]] 0037 then 0038 add_rc="$add_rc\nuseCompressedIndexXML=false\n" 0039 fi 0040 echo -e "$add_rc$BASE_RC" > "$subcheck_dir/kphotoalbumrc" || return $result_err_setup 0041 0042 # prepare database: 0043 cp "$data_dir/$subcheck.orig.xml" "$subcheck_dir/index.xml" || return $result_err_setup 0044 0045 export XDG_CONFIG_HOME="$subcheck_dir" 0046 kphotoalbum --db "$subcheck_dir/index.xml" > "$subcheck_dir/log" 2>&1 || return $result_err_crash 0047 0048 if ! diff -u "$data_dir/$subcheck.result.xml" "$subcheck_dir/index.xml" 0049 then 0050 log notice "$check_name/$subcheck: Mismatch in index.xml!" 0051 return $result_failed 0052 fi 0053 0054 sed -i "s:$TEMPDIR:IMAGEROOT:g" "$subcheck_dir/log" 0055 if ! diff -u "$data_dir/$subcheck.expected.log" "$subcheck_dir/log" 0056 then 0057 log notice "$check_name/$subcheck: Mismatch in log messages!" 0058 return $result_failed 0059 fi 0060 done 0061 return $result_ok 0062 }