🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #17712

Re: symlink/crosspost errors

#17712
From: Frank Durda IV
Date: Mon, 12 May 1997 00:00
86 lines
3642 bytes
Cs. wrote:
> 
> I am getting the following type errors daily (2+megs worth of log file!!)
> 
> crosspost cant symlink
> /var/news/spool/articles/alt/binaries/pictures/lesbians/13327
> alt/binaries/pictures/girlfriends/26071 : File exists


We got tired of this (particularly after we discovered a security hole
in innd that lets someone make innd silently exit and leaves you with
dozens of these things each time you restart innd).  So we now use:


diff -c art.c00 art.c 
*** art.c00     Mon Mar 04 10:21:48 1996
--- art.c       Fri Apr 25 21:24:13 1997
***************
*** 2,7 ****
--- 2,14 ----
  **
  **  Article-processing.
  */
+ /*
+ <8>   If symlink attempt fails, try deleting destination first.
+       25-Apr-97  Frank Durda IV	uhclem%nemesis.lonestar.org
+ */
+ 
+ #define EDIT8
+ 
  #include "innd.h"
  #include "dbz.h"
  #include <sys/uio.h>
***************
*** 2042,2047 ****
--- 2049,2066 ----
  #else
                /* Try to make a symbolic link to the full pathname. */
                FileGlue(buff, SPOOL, '/', Data.Name);
+ #ifdef EDIT8
+               if (symlink(buff, linkname) < 0) {
+                   if (unlink(linkname) || symlink(buff,linkname)) /*<8>Try nuking*/
+                       if ((!MakeSpoolDirectory(ngp->Dir)
+                           || symlink(buff, linkname) < 0)) {
+                               IOError("symlinking article");
+                               syslog(L_ERROR, "%s cant symlink %s and %s %m",
+                                      LogName, buff, linkname);
+                               continue;
+                       }
+               }
+ #else /*EDIT8*/
                if (symlink(buff, linkname) < 0
                 && (!MakeSpoolDirectory(ngp->Dir)
                  || symlink(buff, linkname) < 0)) {
***************
*** 2050,2055 ****
--- 2069,2075 ----
                        LogName, buff, linkname);
                    continue;
                }
+ #endif /*EDIT8*/
  #endif        /* defined(DONT_HAVE_SYMLINK) */
            }
            *p++ = ' ';


If the symlink fails, the first thing it tries is to delete anything
that might be there already.  If that plus symlink fails, then try
making the directory then try symlink as before.  

Yes, you can lose a couple of articles when this happens, but you lose fewer
articles with this than if your system throttles for a couple of hours because
of the "destination already exists - throttling" error and your feeds start
tossing the backlog.   The patch is for 1.4unoff4, but probably fits in
1.5.x OK.



Frank Durda IV <uhclem%nemesis.lonestar.org>|"The Knights who say "LETNi"
or uhclem%nemesis%rwsystr.nkn.net           | demand...  A SEGMENT REGISTER!!!"
   (Annoy a spammer - use % instead of @)   |"A what?"
or ...letni!rwsys!nemesis!uhclem            |"LETNi! LETNi! LETNi!"  - 1983
(c) 1997, ask before reprinting.

Technical Details
Message-ID: <F6F715D88A0EE819.A494B1428BCD765B.518EC525252F3155@library-proxy.airnews.net>
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
References: <5l6pu5$b35$1@ns2.csiway.com>

Show Full Headers
Complete Article Headers
Message-ID: <F6F715D88A0EE819.A494B1428BCD765B.518EC525252F3155@library-proxy.airnews.net>
Subject: Re: symlink/crosspost errors
Date: Mon, 12 May 1997 00:00:00 +0000
From: Frank Durda IV <uhclem%nemesis.lonestar.org>
References: <5l6pu5$b35$1@ns2.csiway.com>
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: 241115995
X-Orig-Message-ID: <33776301.6EEA4806@nemesis.lonestar.org>
Organization: The Big Blue Box B
NNTP-Proxy-Relay: library.airnews.net
Newsgroups: news.software.nntp