groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff-commit] groff/contrib/groffer ChangeLog README_SH groff...


From: Werner LEMBERG
Subject: [Groff-commit] groff/contrib/groffer ChangeLog README_SH groff...
Date: Tue, 16 Nov 2004 04:24:46 -0500

CVSROOT:        /cvsroot/groff
Module name:    groff
Branch:         
Changes by:     Werner LEMBERG <address@hidden> 04/11/16 09:18:42

Modified files:
        contrib/groffer: ChangeLog README_SH groffer.sh 

Log message:
        * release of groffer 0.9.12
        
        * groffer.sh:
        - main_init(): Rewriting of the creation of the temporary
        directory to ensure that it cannot be made writable apart from the
        user.  If the directory already exists and cannot be removed then
        append `X' to the directory name.
        - is_non_empty_file(): fix it to use POSIX `test -s'.
        - is_existing(): new function.
        - POSIX `rm -f -r': use this in `clean_up()' and `main_init()'.
        - `--macro-file': remove this unused long option.
        - `-V', `--source', `--device': move these from groff options
        to groffer options.
        - `$_TMP_DIR_SUB': remove this unused variable.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/groffer/ChangeLog.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/groffer/README_SH.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/groffer/groffer.sh.diff?tr1=1.21&tr2=1.22&r1=text&r2=text

Patches:
Index: groff/contrib/groffer/ChangeLog
diff -u groff/contrib/groffer/ChangeLog:1.22 
groff/contrib/groffer/ChangeLog:1.23
--- groff/contrib/groffer/ChangeLog:1.22        Sat Jun 19 20:47:47 2004
+++ groff/contrib/groffer/ChangeLog     Tue Nov 16 09:18:41 2004
@@ -1,3 +1,20 @@
+2004-11-15  Bernd Warken
+       ________________________________________________________________
+       * release of groffer 0.9.12
+
+       * groffer.sh:
+       - main_init(): Rewriting of the creation of the temporary
+       directory to ensure that it cannot be made writable apart from the
+       user.  If the directory already exists and cannot be removed then
+       append `X' to the directory name.
+       - is_non_empty_file(): fix it to use POSIX `test -s'.
+       - is_existing(): new function.
+       - POSIX `rm -f -r': use this in `clean_up()' and `main_init()'.
+       - `--macro-file': remove this unused long option.
+       - `-V', `--source', `--device': move these from groff options
+       to groffer options.
+       - `$_TMP_DIR_SUB': remove this unused variable.
+
 2004-06-15  Bernd Warken
        ________________________________________________________________
        * release of groffer 0.9.11
Index: groff/contrib/groffer/README_SH
diff -u groff/contrib/groffer/README_SH:1.2 groff/contrib/groffer/README_SH:1.3
--- groff/contrib/groffer/README_SH:1.2 Fri Jun  4 22:42:34 2004
+++ groff/contrib/groffer/README_SH     Tue Nov 16 09:18:41 2004
@@ -98,6 +98,7 @@
 is_dir (<name>)
 is_empty (<string>)
 is_equal (<string1> <string2>)
+is_existing (<name>)
 is_file (<name>)
 is_non_empty_file (<name>)
 is_not_dir (<name>)
@@ -108,6 +109,7 @@
 is_not_writable (<name>)
 is_not_yes (<string>)
 is_prog (<name>)
+is_writable (<name>)
 is_yes (<string>)
 leave ()
 landmark (<text>)
@@ -127,6 +129,10 @@
 manpath_add_system()
 manpath_from_path ()
 normalize_args (<shortopts> <longopts> <arg>*)
+obj (<object> <call_name> <arg>...)
+obj_data (<object>)
+obj_from_output (<object> <call_name> <arg>...)
+obj_set (<object> <data>)
 path_chop (<path>)
 path_clean (<path>)
 path_contains (<path> <dir>)
Index: groff/contrib/groffer/groffer.sh
diff -u groff/contrib/groffer/groffer.sh:1.21 
groff/contrib/groffer/groffer.sh:1.22
--- groff/contrib/groffer/groffer.sh:1.21       Sat Jun 19 20:47:47 2004
+++ groff/contrib/groffer/groffer.sh    Tue Nov 16 09:18:41 2004
@@ -25,8 +25,8 @@
 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 _PROGRAM_NAME='groffer';
-_PROGRAM_VERSION='0.9.11';
-_LAST_UPDATE='15 June 2004';
+_PROGRAM_VERSION='0.9.12';
+_LAST_UPDATE='15 November 2004';
 
 
 ########################################################################
@@ -334,18 +334,18 @@
 
 _OPTS_GROFFER_LONG_ARG="\
 'apropos' 'apropos-data' 'apropos-devel' 'apropos-progs' \
-'default-modes' 'dvi-viewer' 'extension' 'fg' 'fn' 'font' \
+'default-modes' 'device' 'dvi-viewer' 'extension' 'fg' 'fn' 'font' \
 'foreground' 'html-viewer' 'mode' 'pdf-viewer' 'ps-viewer' 'shell' \
 'tty-viewer' 'www-viewer' 'x-viewer' 'X-viewer'";
 
 ##### groffer options inhereted from groff
 
 _OPTS_GROFF_SHORT_NA="'a' 'b' 'c' 'C' 'e' 'E' 'g' 'G' 'i' 'l' 'N' 'p' \
-'R' 's' 'S' 't' 'U' 'V' 'z'";
+'R' 's' 'S' 't' 'U' 'z'";
 _OPTS_GROFF_SHORT_ARG="'d' 'f' 'F' 'I' 'L' 'm' 'M' 'n' 'o' 'P' 'r' \
 'w' 'W'";
-_OPTS_GROFF_LONG_NA="'source'";
-_OPTS_GROFF_LONG_ARG="'device' 'macro-file'";
+_OPTS_GROFF_LONG_NA="";
+_OPTS_GROFF_LONG_ARG="";
 
 ##### groffer options inhereted from the X Window toolkit
 
@@ -473,8 +473,7 @@
 export _OPT_XRM;               # specify X resource.
 export _OPT_Z;                 # groff option -Z.
 # _TMP_* temporary files
-export _TMP_DIR;               # groff directory for temporary files
-export _TMP_DIR_SUB;           # groffer directory for temporary files
+export _TMP_DIR;               # groffer directory for temporary files
 export _TMP_CAT;               # stores concatenation of everything
 export _TMP_STDIN;             # stores stdin, if any
 
@@ -533,7 +532,6 @@
 
 # _TMP_* temporary files
 _TMP_DIR='';
-_TMP_DIR_SUB='';
 _TMP_CAT='';
 _TMP_STDIN='';
 
@@ -653,8 +651,7 @@
 clean_up()
 {
   if test -d "${_TMP_DIR}"; then
-    rm -f "${_TMP_DIR}"/*;
-    rmdir "${_TMP_DIR}";
+    rm -f -r "${_TMP_DIR}";
   fi;
 }
 
@@ -1459,6 +1456,24 @@
 
 
 ########################################################################
+# is_existing (<name>)
+#
+# Test whether `name' is an existing file or directory.
+#
+# Arguments : 1
+# Return    : `0' if arg1 exists, `1' otherwise.
+#
+is_existing()
+{
+  func_check is_existing = 1 "$@";
+  if test -e "$1"; then
+    eval "${return_yes}";
+  fi;
+  eval "${return_no}";
+}
+
+
+########################################################################
 # is_file (<name>)
 #
 # Test whether `name' is a readable file.
@@ -1488,11 +1503,9 @@
 #
 is_non_empty_file()
 {
-  func_check is_empty = 1 "$@";
-  if is_file "$1"; then
-    if is_not_empty "$(cat "$1" | sed -e '/./q')"; then
-      eval "${return_yes}";
-    fi;
+  func_check is_non_empty_file = 1 "$@";
+  if is_file "$1" && test -s "$1"; then
+    eval "${return_yes}";
   fi;
   eval "${return_no}";
 }
@@ -3211,7 +3224,7 @@
 #
 # set exit trap and create temporary files
 #
-# Globals: $_TMP_CAT, $_TMP_STDIN
+# Globals: $_TMP_DIR, $_TMP_CAT, $_TMP_STDIN
 #
 landmark '13: main_init()';
 main_init()
@@ -3220,32 +3233,52 @@
   # call clean_up() on any signal
   trap_set clean_up;
 
-  # determine temporary directory
-  umask 000;
+  # create temporary directory
+  umask 0022;
   _TMP_DIR='';
   for d in "${GROFF_TMPDIR}" "${TMPDIR}" "${TMP}" "${TEMP}" \
            "${TEMPDIR}" "${HOME}"'/tmp' '/tmp' "${HOME}" '.';
   do
-    if is_not_empty "$d"; then
-      if obj d is_dir && obj d is_writable; then
-        _TMP_DIR="${d}/${_PROGRAM_NAME}${_PROCESS_ID}";
-        if obj _TMP_DIR is_dir; then
-         rm -f "${_TMP_DIR}"/*;
-          break;
-        else
-          mkdir "${_TMP_DIR}";
-          if obj _TMP_DIR is_not_dir; then
-            _TMP_DIR='';
-           continue;
-          fi;
-          break;
-       fi;
+    if obj d is_empty || obj d is_not_dir || obj d is_not_writable; then
+      continue;
+    fi;
+    case "$d" in
+    */)
+      _TMP_DIR="${d}";
+      ;;
+    *)
+      _TMP_DIR="${d}"'/';
+      ;;
+    esac;
+    _TMP_DIR="${_TMP_DIR}${_PROGRAM_NAME}${_PROCESS_ID}";
+    while obj _TMP_DIR is_existing; do
+      rm -f -r "${_TMP_DIR}" 2>/dev/null;
+      if obj _TMP_DIR is_existing; then
+        # $_TMP_DIR could not be removed
+        _TMP_DIR="${_TMP_DIR}"'X';
+        continue;
+      else
+        # $_TMP_DIR was removed
+        break;
       fi;
-      if obj _TMP_DIR is_not_writable; then
-       _TMP_DIR='';
-       continue;
+    done;
+    mkdir "${_TMP_DIR}";
+    if is_not_equal "$?" 0; then
+      if obj _TMP_DIR is_existing; then
+        rm -f -r "${_TMP_DIR}" 2>/dev/null;
       fi;
+      _TMP_DIR='';
+      continue;
+    fi;
+    if obj _TMP_DIR is_dir && obj _TMP_DIR is_writable; then
+      # $_TMP_DIR can now be used as temporary directory
+      break;
+    fi;
+    if obj _TMP_DIR is_existing; then
+      rm -f -r "${_TMP_DIR}" 2>/dev/null;
     fi;
+    _TMP_DIR='';
+    continue;
   done;
   unset d;
   if obj _TMP_DIR is_empty; then




reply via email to

[Prev in Thread] Current Thread [Next in Thread]