2727PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
2828export PATH
2929
30- TLOG_VERSION=" 2.0.2 "
30+ TLOG_VERSION=" 2.0.4 "
3131
3232# BASERUN: cursor storage directory — sed-replaced at install time
3333BASERUN=" ${BASERUN:-/ tmp} "
@@ -259,8 +259,8 @@ if [[ ! -f "$_LIB" ]]; then
259259fi
260260
261261# Security check: library must be root-owned and not world-writable
262- _lib_owner=$( stat -L -c ' %u' " $_LIB " 2> /dev/null)
263- _lib_perms=$( stat -L -c ' %a' " $_LIB " 2> /dev/null)
262+ _lib_owner=$( stat -L -c ' %u' " $_LIB " 2> /dev/null) # stat may fail if lib deleted between checks
263+ _lib_perms=$( stat -L -c ' %a' " $_LIB " 2> /dev/null) # stat may fail if lib deleted between checks
264264_lib_world=" ${_lib_perms: -1} "
265265if [[ " $_lib_owner " != " 0" ]] || [[ $(( _lib_world & 2 )) -ne 0 ]]; then
266266 echo " tlog: security check failed on $_LIB (owner=$_lib_owner perms=$_lib_perms )" >&2
@@ -356,7 +356,7 @@ _tlog_cmd_status() {
356356 if [[ $parse_rc -eq 2 ]]; then
357357 # Corrupt cursor: show raw content for diagnosis
358358 local raw_value=" "
359- read -r raw_value < " $cursor_file " 2> /dev/null || true
359+ read -r raw_value < " $cursor_file " 2> /dev/null || true # read exits 1 on EOF; not an error
360360 printf ' raw: %s\n' " $raw_value "
361361 printf ' state: corrupt (would auto-reset on next read)\n'
362362 elif [[ -z " $_tlog_cursor_value " ]]; then
@@ -369,7 +369,7 @@ _tlog_cmd_status() {
369369 # Cursor age
370370 if [[ -f " $cursor_file " ]]; then
371371 local mtime now age_s
372- mtime=$( stat -c %Y " $cursor_file " 2> /dev/null) || mtime=0
372+ mtime=$( stat -c %Y " $cursor_file " 2> /dev/null) || mtime=0 # stat fails if cursor removed; default to 0
373373 now=$( date +%s)
374374 age_s=$(( now - mtime))
375375 if [[ $age_s -ge 86400 ]]; then
@@ -411,7 +411,7 @@ _tlog_cmd_status() {
411411 # Related files
412412 if [[ -f " $BASERUN /${name} .jts" ]]; then
413413 local jts_val
414- read -r jts_val < " $BASERUN /${name} .jts" 2> /dev/null || true
414+ read -r jts_val < " $BASERUN /${name} .jts" 2> /dev/null || true # read exits 1 on EOF; not an error
415415 printf ' jts: %s\n' " $jts_val "
416416 fi
417417 if [[ -f " $BASERUN /${name} .lock" ]]; then
@@ -440,21 +440,21 @@ _tlog_cmd_reset() {
440440
441441 # Cursor file
442442 if [[ -f " $BASERUN /$name " ]]; then
443- rm -f " $BASERUN /$name "
443+ command rm -f " $BASERUN /$name "
444444 printf ' removed: %s\n' " $BASERUN /$name "
445445 found=1
446446 fi
447447
448448 # Journal timestamp
449449 if [[ -f " $BASERUN /${name} .jts" ]]; then
450- rm -f " $BASERUN /${name} .jts"
450+ command rm -f " $BASERUN /${name} .jts"
451451 printf ' removed: %s\n' " $BASERUN /${name} .jts"
452452 found=1
453453 fi
454454
455455 # Lock file
456456 if [[ -f " $BASERUN /${name} .lock" ]]; then
457- rm -f " $BASERUN /${name} .lock"
457+ command rm -f " $BASERUN /${name} .lock"
458458 printf ' removed: %s\n' " $BASERUN /${name} .lock"
459459 found=1
460460 fi
@@ -463,7 +463,7 @@ _tlog_cmd_reset() {
463463 local tmpfile
464464 for tmpfile in " $BASERUN " /." ${name} " .?????? ; do
465465 if [[ -f " $tmpfile " ]]; then
466- rm -f " $tmpfile "
466+ command rm -f " $tmpfile "
467467 printf ' removed: %s\n' " $tmpfile "
468468 found=1
469469 fi
@@ -472,7 +472,7 @@ _tlog_cmd_reset() {
472472 # Orphaned JTS temp files (mktemp pattern: .NAME.jts.XXXXXX)
473473 for tmpfile in " $BASERUN " /." ${name} " .jts.?????? ; do
474474 if [[ -f " $tmpfile " ]]; then
475- rm -f " $tmpfile "
475+ command rm -f " $tmpfile "
476476 printf ' removed: %s\n' " $tmpfile "
477477 found=1
478478 fi
0 commit comments