NetBSD-Bugs archive

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

re: bin/56631: rdump fails to back up to remote file



The following reply was made to PR bin/56631; it has been noted by GNATS.

From: matthew green <mrg%eterna.com.au@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: re: bin/56631: rdump fails to back up to remote file
Date: Sun, 16 Jan 2022 19:17:34 +1100

 one problem is that the rmt protocol is kinda broken in that
 there's no clear definition of what is passed to open() when
 the remote processes does this.
 
 unlike local files, dump won't pass O_CREAT to the remote
 connection, so, if the file doesn't already exist it won't
 be used.
 
 from dump/dumprmt.c:
 
 rmtopen(const char *tapedevice, int mode, int verbose)
 {
         char buf[256];
 
         (void)snprintf(buf, sizeof buf, "O%s\n%d\n", tapedevice, mode);
         rmtstate = TS_OPEN;
         return (rmtcall(tapedevice, buf, verbose));
 }
 
 there are 3 callers:
 
         while (rmtopen(tape, 0, 0) < 0)
                         if (rmtopen(tape, 0, 0) >= 0) {
         while ((tapefd = (host ? rmtopen(tape, 2, 1) :
 
 note how they pass "0" or "2" as "int mode".  what do these
 0 and 2 magic numbers mean?  oh let's see in rmt(8):
 
 from rmt/rmt.c:
 
                 getstring(device, sizeof(device));
                 getstring(mode, sizeof(mode));
                 DEBUG2("rmtd: O %s %s\n", device, mode);
                 tape = open(device, atoi(mode),
                     S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
 
 in other words, these values are passed to the remote host
 directly as the mode argument to open().  in netbsd (and most
 bsd i assume still, these days, and linux has the same in the
 generic configs, but i recall there was something sysV that
 changed these values):
 
 #define O_RDONLY        0x00000000      /* open for reading only */
 #define O_RDWR          0x00000002      /* open for reading and writing */
 
 but there's no O_CREAT, so remote files are not created.
 
 
 .mrg.
 


Home | Main Index | Thread Index | Old Index