🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #11327

Bugs in news.daily when history not on local drive

#11327
From: Frank Durda IV
Date: Wed, 02 Oct 1996 00:00
222 lines
8516 bytes
I came across a couple of bugs in news.daily that only show up if you have
the history files on a different drive.  There is code to handle this
case, but in one case the person who tried to configure it didn't do what
the designer expected, and in the second case, innd is left paused for hours.

In my case, someone before I came along moved history because of its massive
size to a different drive, all by itself.  They also put symlinks in
/usr/local/news so that the other various parts of the system could locate
the history files.

When it came to news.daily, they apparently didn't think of changing the
cron entry and adding expdir=/history to the command line for news.daily.
Instead they found a section in news.daily called "Set defaults" and
changed EXPDIR= to EXPDIR=/history.   Makes perfect sense.

But what happens is that the script is expecting EXPDIR to be empty UNLESS
the command line expdir= was actually specified.  If the command line
entry is specified, a second variable "REASON" is also computed.  So what happens
is later on, expire is run with a "-r" parameter and an empty field following
it, followed by -z/history.  This causes "-z/history" to be used as the
Pause Reason for innd, and expire no deletes as it goes instead of building
the expire.rm file as expected.

On our system, when we discovered this, we estimated that the expire which
was building the history.n file at the dazzling rate of 8192 bytes per MINUTE
would take roughly 27 days to complete.

The fix is to either use expdir= on the command line, OR to compute the contents
of REASON when the other defaults are set.  A patch to do this latter thing
is included below.

        
The second problem is that because of the order of the script, if you have  
history on a different drive, expire finishes building the new history files,
pauses the server, and exits as expected.  What SHOULD happen is that the
code in the script to move the new history files into position and release
innd should run at this point, but these steps are positioned AFTER processing
the overview files and running the fastrm.  The overview operations here
take several hours by themselves, so innd would remain paused all this time.
      
A patch below re-arranges the script so that the history files are positioned
and innd released as soon as expire exits, THEN expireover and fastrm are run,
which would be the order of events if expire had done all the work itself if
history had been on the same drive as the rest of news.

(Note: I came up with this change a few weeks ago and note that someone may
 have addressed this differently by changing expire to be smarter.  There should
 be no overlap problems with these changes, but you should check.)

 
 
*** news.daily.00       Wed Oct  2 10:54:00 1996 
--- news.patchtarget    Wed Oct  2 10:53:17 1996
***************
*** 15,20 ****
--- 15,35 ----
  ##    delayrm         Delay unlink files, then do it quicker (expire -z)
  ##    /full/path      Path to a program to run before expiring

+ ##Edit History 
+ ##<1> The following changes have been made to this script:
+ ##    1. The REASON variable is always initialized, not just if the expdir
+ ##       parameter is found on the command line.  If EXPDIR default was set
+ ##       internally to something other than null, a -r with no
+ ##       parameter would be passed to expire, causing the next parameter for
+ ##       expire to be ignored silently.
+ ##    2. Changed the order so that if the script is updating history,
+ ##       it will move the new files into position and unpause innd as soon
+ ##       as expire finishes running.  Previously, it left innd paused until
+ ##       all overview files are updated, sorts are run and expire files
+ ##       deleted, all of which could take hours.  This only happened if
+ ##       the history files were not on the same partition as news.
+ ##    25-Sep-96 Frank Durda IV  uhclem@nemesis.lonestar.org
+
  ##  =()<. @<_PATH_SHELLVARS>@>()=
  . /usr/local/news/innshellvars

***************
*** 44,50 ****
  EXPIREFLAGS="-v1"
  EXPIREOVERFLAGS=
  PROGRAMS=
! REASON=
  RMFILE=
  SCANARG=

--- 59,65 ----
  EXPIREFLAGS="-v1"
  EXPIREOVERFLAGS=
  PROGRAMS=
! REASON="Expiring $$ on ${EXPDIR}"
  RMFILE=
  SCANARG=

***************
*** 57,63 ****
        ;;
      Xexpdir=*)
        EXPDIR=`expr "${I}" : 'expdir=\(.*\)'`
-       REASON="Expiring $$ on ${EXPDIR}"
        ;;
      Xexpireover)
        DOEXPIREOVER=true
--- 72,77 ----
***************
*** 194,199 ****
--- 208,214 ----
      fi

  ##  Actual expire the articles (finally!).
+
      if ${DOEXPLOG}; then
        echo "expire begin `date`: (${EXPIREFLAGS})"            >>${EXPLOG}
        ( exec 2>&1 ; eval expire "${EXPIREFLAGS}" ) \
***************
*** 202,218 ****
      else
        eval expire "${EXPIREFLAGS}"
      fi
-     test -n "${RMFILE}" -a -f "${RMFILE}" && {
-       sort -u -o ${RMFILE} ${RMFILE}
-       ${DOEXPIREOVER} && {
-           eval expireover "${EXPIREOVERFLAGS}"
-           DOEXPIREOVER=false
-       }
-       expirerm ${RMFILE}
-     }
-     ${DOEXPIREOVER} && eval expireover "${EXPIREOVERFLAGS}"

      ##  If built on another filesystem, move history files.
      if [ -n "${EXPDIR}" ] ; then
        if [ ! -f ${EXPDIR}/history.n -o ! -f ${EXPDIR}/history.n.done ] ; then
            ( echo "$0: No new history files"; ${INNSTAT} ) | eval ${MAIL}
--- 217,225 ----
      else
        eval expire "${EXPIREFLAGS}"
      fi

  ##  If built on another filesystem, move history files.
+
      if [ -n "${EXPDIR}" ] ; then
        if [ ! -f ${EXPDIR}/history.n -o ! -f ${EXPDIR}/history.n.done ] ; then
            ( echo "$0: No new history files"; ${INNSTAT} ) | eval ${MAIL}
***************
*** 231,237 ****
        esac
      fi

!     ##  Restart the server if we need to.
      if ${THROTTLED} || test -n "${MESSAGE}" ; then
        ctlinnd -s go "${MESSAGE}" 2>&1 || {
            ( echo "$0: Cannot unthrottle news"; ${INNSTAT} ) | eval ${MAIL}
--- 238,245 ----
        esac
      fi

! ##  Restart the server if we need to (unpause).
!
      if ${THROTTLED} || test -n "${MESSAGE}" ; then
        ctlinnd -s go "${MESSAGE}" 2>&1 || {
            ( echo "$0: Cannot unthrottle news"; ${INNSTAT} ) | eval ${MAIL}
***************
*** 238,246 ****
--- 246,269 ----
            exit 1
        }
      fi
+
+ ##<1>Do overview file updates if requested and handle deleting delrm files.
+
+     test -n "${RMFILE}" -a -f "${RMFILE}" && {
+       sort -u -o ${RMFILE} ${RMFILE}
+       ${DOEXPIREOVER} && {
+           eval expireover "${EXPIREOVERFLAGS}"
+           DOEXPIREOVER=false
+       }
+       expirerm ${RMFILE}
+     }
+     ${DOEXPIREOVER} && eval expireover "${EXPIREOVERFLAGS}"
+
  fi
+ ## end if DOEXPIRE

  ##  Renumber the active file.
+
  if ${DORENUMBER} ; then
      echo ''
      echo 'Renumbering active file.'
***************
*** 260,269 ****
--- 283,294 ----
  }

  ##  Remove old sockets.
+
  ${DORM} &&
      find ${TEMPSOCKDIR} -name "${TEMPSOCK}" -mtime +2 -exec rm -f '{}' ';'

  ##  Mail the report.
+
  if ${DOMAIL} ; then
      # Stop using the temp file, and mail captured output.
      exec 1>&3 2>&1 3>&-
***************
*** 272,277 ****
--- 297,303 ----
  fi

  ##  All done; warn if we can't release the lock.
+
  rm ${LOCK}
  date >${NEWSLIB}/.news.daily
  ${RNEWS} -U


Frank Durda IV <uhclem@nemesis.lonestar.org>|"The Knights who say "LETNi"
or uhclem%nemesis@rwsystr.nkn.net           | demand...  A SEGMENT REGISTER!!!"
                                            |"A what?"
or ...letni!rwsys!nemesis!uhclem            |"LETNi! LETNi! LETNi!"  - 1983

Technical Details
Message-ID: <32529DC0.167EB0E7@nemesis.lonestar.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <32529DC0.167EB0E7@nemesis.lonestar.org>
Subject: Bugs in news.daily when history not on local drive
Date: Wed, 02 Oct 1996 00:00:00 +0000
From: Frank Durda IV <uhclem@nemesis.lonestar.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 186717375
Content-type: text/plain; charset=us-ascii
Organization: The Big Blue Box B
Mime-version: 1.0
Newsgroups: news.software.nntp
X-mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.1.5-RELEASE i386)