Fix eread to not accept invalid input for file selection. (Bug #189994)
authorfuzzyray <fuzzyray@gentoo.org>
Thu, 13 Sep 2007 02:53:42 +0000 (02:53 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Thu, 13 Sep 2007 02:53:42 +0000 (02:53 -0000)
svn path=/; revision=436

trunk/ChangeLog
trunk/src/eread/eread

index 4c939be9091bff12ac463d29d98a028b3bb6167f..105cdb6695054d3d249f2952e3db9bab31d0d06e 100644 (file)
@@ -3,6 +3,8 @@
        #192345)
        * revdep-rebuild: Correctly handle the case where an ebuild no longer
        exists for a package (Bug #188918)
+       * eread: Fix eread to not accept invalid input for file selection.
+       (Bug #189994)
 
 2007-08-08: Paul Varner <fuzzyray@gentoo.org>
        * revdep-rebuild: Fix progress bar to only update when there is a
index 20974604c61ac445c09fb109d063c1cd06a9a8f1..c6d4de13f5d11afbee0b7de8f71ae8aff246e5f4 100755 (executable)
@@ -49,31 +49,36 @@ select_loop() {
                                break
                                ;;
                        *)
-                               ${PAGER} ${FILE}
-                               read -p "Delete file? [y/N] " DELETE
-                               case ${DELETE} in
-                                       q)
-                                               echo "Quitting"
-                                               QUIT="yes"
-                                               break
-                                               ;;
-                                       y|Y)
-                                               rm -f ${FILE}
-                                               SUCCESS=$?
-                                               if [[ ${SUCCESS} = 0 ]]; then
-                                                       echo "Deleted ${FILE}"
-                                               else
-                                                       echo "Unable to delete ${FILE}"
-                                               fi
-                                               ;;
-                                       # Empty string defaults to N (save file)
-                                       n|N|"")
-                                               echo "Saving ${FILE}"
-                                               ;;
-                                       *)
-                                               echo "Invalid response. Saving ${FILE}"
-                                               ;;
-                               esac
+                               if [ -f "$FILE" ]; then
+                                       ${PAGER} ${FILE}
+                                       read -p "Delete file? [y/N] " DELETE
+                                       case ${DELETE} in
+                                               q)
+                                                       echo "Quitting"
+                                                       QUIT="yes"
+                                                       break
+                                                       ;;
+                                               y|Y)
+                                                       rm -f ${FILE}
+                                                       SUCCESS=$?
+                                                       if [[ ${SUCCESS} = 0 ]]; then
+                                                               echo "Deleted ${FILE}"
+                                                       else
+                                                               echo "Unable to delete ${FILE}"
+                                                       fi
+                                                       ;;
+                                               # Empty string defaults to N (save file)
+                                               n|N|"")
+                                                       echo "Saving ${FILE}"
+                                                       ;;
+                                               *)
+                                                       echo "Invalid response. Saving ${FILE}"
+                                                       ;;
+                                       esac
+                               else
+                                       echo
+                                       echo "Invalid response."
+                               fi
                                ;;
                esac
                break