Changed hard links to symbolic links in download areas
This commit is contained in:
parent
0ab82503b7
commit
e957fac3c7
18
ChangeLog
18
ChangeLog
@ -1,5 +1,10 @@
|
||||
$Id$
|
||||
|
||||
NOTE: for previous 0.35.06 users, the hard links are now replaced with
|
||||
symbolic links. Run mbfile check to update if you were running
|
||||
a pre 09-12-2002 version. Backup everything!! If all went well the
|
||||
backups should be in size back to normal.
|
||||
|
||||
|
||||
MBSEBBS History.
|
||||
|
||||
@ -39,7 +44,7 @@ v0.35.06
|
||||
general:
|
||||
This may become release 0.36.00 (again).
|
||||
Added better support for 8.3 and long filenames by creating
|
||||
hard links in the download directories.
|
||||
symbolic links in the download directories.
|
||||
|
||||
common.a:
|
||||
Changed the LFN name mangle functions to prevent 8.3 name
|
||||
@ -56,10 +61,12 @@ v0.35.06
|
||||
|
||||
mbsebbs:
|
||||
Several user input functions don't allow comma's anymore.
|
||||
Uploaded files will now also have a 8.3 hard link to the long
|
||||
filename.
|
||||
Uploaded files will now also have a symbolic link to then
|
||||
long filename from the real 8.3 filename.
|
||||
Filesearch on filename now uses regexp to find the files.
|
||||
The caller id didn't show up when the info was available.
|
||||
A user with only a limit on download files or download Kb could
|
||||
not download at all.
|
||||
|
||||
mbfido:
|
||||
TIC file forwarding now uses a list of qualified systems to
|
||||
@ -68,7 +75,8 @@ v0.35.06
|
||||
Imported tic files with a new banner file in the archive got
|
||||
the wrong filetime in the files database. The mbfile check
|
||||
command would detect and correct this.
|
||||
TIC files added to the bbs will now also have a 8.3 hard link.
|
||||
TIC files added to the bbs will now also have a long filename
|
||||
symbolic link.
|
||||
With TIC file attaches, the filename attached is the 8.3 name.
|
||||
TIC processing completly modified to make better LFN support,
|
||||
internal everything works on the 8.3 filename.
|
||||
@ -90,7 +98,7 @@ v0.35.06
|
||||
|
||||
mbfile:
|
||||
Finished complete support for 8.3 and long filenames.
|
||||
The check function now creates hard links in the download
|
||||
The check function now creates symbolic links in the download
|
||||
areas with the 8.3 filename to the long filename so that the
|
||||
files seem to exist under both names.
|
||||
The delete and move functions can now use 8.3 or long
|
||||
|
@ -464,7 +464,7 @@ void name_mangle(char *OutName)
|
||||
*/
|
||||
if (!is_8_3(OutName)) {
|
||||
mangle_name_83(OutName);
|
||||
Syslog('f',"name_mangle(%s) ==> [%s]", p, OutName);
|
||||
// Syslog('f',"name_mangle(%s) ==> [%s]", p, OutName);
|
||||
} else {
|
||||
/*
|
||||
* No mangling needed, convert to uppercase
|
||||
|
@ -148,7 +148,7 @@ int Add_BBS()
|
||||
chmod(temp2, 0644);
|
||||
lname = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(lname, "%s/%s", TIC.BBSpath, frec.LName);
|
||||
if (link(temp2, lname)) {
|
||||
if (symlink(temp2, lname)) {
|
||||
WriteError("$Create link %s to %s failed", temp2, lname);
|
||||
}
|
||||
free(lname);
|
||||
|
@ -66,8 +66,8 @@ extern int do_pack; /* Pack filebase */
|
||||
void Check(void)
|
||||
{
|
||||
FILE *pAreas, *pFile;
|
||||
int i, iAreas, iAreasNew = 0, Fix, inArea, iTotal = 0, iErrors = 0;
|
||||
char *sAreas, *fAreas, *newdir, *temp, *lname;
|
||||
int i, j, iAreas, iAreasNew = 0, Fix, inArea, iTotal = 0, iErrors = 0;
|
||||
char *sAreas, *fAreas, *newdir, *temp, *mname, *tname;
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
int Found, Update;
|
||||
@ -80,7 +80,7 @@ void Check(void)
|
||||
fAreas = calloc(PATH_MAX, sizeof(char));
|
||||
newdir = calloc(PATH_MAX, sizeof(char));
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
lname = calloc(PATH_MAX, sizeof(char));
|
||||
mname = calloc(PATH_MAX, sizeof(char));
|
||||
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
@ -202,8 +202,9 @@ void Check(void)
|
||||
iTotal++;
|
||||
inArea++;
|
||||
sprintf(newdir, "%s/%s", area.Path, file.LName);
|
||||
sprintf(mname, "%s/%s", area.Path, file.Name);
|
||||
|
||||
if (file_exist(newdir, R_OK)) {
|
||||
if (file_exist(newdir, R_OK) && file_exist(mname, R_OK)) {
|
||||
Syslog('+', "File %s area %d not on disk.", newdir, i);
|
||||
if (!file.NoKill) {
|
||||
file.Deleted = TRUE;
|
||||
@ -222,25 +223,108 @@ void Check(void)
|
||||
|
||||
strcpy(temp, file.LName);
|
||||
name_mangle(temp);
|
||||
sprintf(lname, "%s/%s", area.Path, temp);
|
||||
sprintf(mname, "%s/%s", area.Path, temp);
|
||||
if (strcmp(file.Name, temp)) {
|
||||
Syslog('!', "Converted %s to %s", file.Name, temp);
|
||||
tname = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(tname, "%s/%s", area.Path, file.Name);
|
||||
rename(tname, mname);
|
||||
free(tname);
|
||||
strncpy(file.Name, temp, 12);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check hard link to the short/mangled filename.
|
||||
* If 8.3 and LFN are the same, try to rename the LFN to lowercase.
|
||||
*/
|
||||
if (strcmp(file.Name, file.LName)) {
|
||||
if (file_exist(lname, F_OK)) {
|
||||
if (link(newdir, lname)) {
|
||||
WriteError("$Can't create link %s to %s", lname, newdir);
|
||||
if (strcmp(file.Name, file.LName) == 0) {
|
||||
/*
|
||||
* 8.3 and LFN are the same.
|
||||
*/
|
||||
tname = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(tname, "%s/%s", area.Path, file.LName);
|
||||
for (j = 0; j < strlen(file.LName); j++)
|
||||
file.LName[j] = tolower(file.LName[j]);
|
||||
sprintf(newdir, "%s/%s", area.Path, file.LName);
|
||||
if (strcmp(tname, newdir)) {
|
||||
Syslog('+', "Rename LFN from %s to %s", file.Name, file.LName);
|
||||
rename(tname, newdir);
|
||||
Update = TRUE;
|
||||
}
|
||||
free(tname);
|
||||
}
|
||||
|
||||
/*
|
||||
* At this point we may have (depending on the upgrade level)
|
||||
* a real file with a long name or a real file with a short name
|
||||
* or both. One of them may also be a symbolic link or not exist
|
||||
* at all. Whatever it was, make it good.
|
||||
*/
|
||||
if ((lstat(newdir, &stb) == 0) && ((stb.st_mode & S_IFLNK) != S_IFLNK)) {
|
||||
/*
|
||||
* Long filename is a regular file and not a symbolic link.
|
||||
*/
|
||||
if (lstat(mname, &stb) == 0) {
|
||||
/*
|
||||
* 8.3 name exists, is it a real file?
|
||||
*/
|
||||
if ((stb.st_mode & S_IFLNK) != S_IFLNK) {
|
||||
unlink(newdir);
|
||||
symlink(mname, newdir);
|
||||
Syslog('+', "%s changed into symbolic link", newdir);
|
||||
iErrors++;
|
||||
} else {
|
||||
Syslog('!', "Created hard link area %d LFN %s to 8.3 %s", i, file.LName, file.Name);
|
||||
/*
|
||||
* 8.3 is a symbolic link.
|
||||
*/
|
||||
unlink(mname);
|
||||
rename(newdir, mname);
|
||||
symlink(mname, newdir);
|
||||
Syslog('+', "%s changed to real file", mname);
|
||||
iErrors++;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* No 8.3 name on disk.
|
||||
*/
|
||||
rename(newdir, mname);
|
||||
symlink(mname, newdir);
|
||||
Syslog('+', "%s changed to real file and created symbolic link", mname);
|
||||
iErrors++;
|
||||
}
|
||||
} else if ((lstat(mname, &stb) == 0) && ((stb.st_mode & S_IFLNK) != S_IFLNK)) {
|
||||
/*
|
||||
* Short filename is a real file.
|
||||
*/
|
||||
if (lstat(newdir, &stb) == 0) {
|
||||
/*
|
||||
* LFN exists, is it a real file?
|
||||
*/
|
||||
if ((stb.st_mode & S_IFLNK) != S_IFLNK) {
|
||||
/*
|
||||
* LFN is a real filename too.
|
||||
*/
|
||||
unlink(newdir);
|
||||
symlink(mname, newdir);
|
||||
Syslog('+', "%s changed into symbolic link", newdir);
|
||||
iErrors++;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* No LFN, create symbolic link
|
||||
*/
|
||||
symlink(mname, newdir);
|
||||
Syslog('+', "%s created symbolic link", newdir);
|
||||
iErrors++;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Weird, could not happen
|
||||
*/
|
||||
Syslog('!', "Weird problem, %s is no regular file", newdir);
|
||||
}
|
||||
|
||||
if (file_time(newdir) != file.FileDate) {
|
||||
Syslog('!', "Date mismatch area %d file %s", i, file.LName);
|
||||
file.FileDate = file_time(newdir);
|
||||
@ -345,7 +429,7 @@ void Check(void)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
free(lname);
|
||||
free(mname);
|
||||
free(temp);
|
||||
free(newdir);
|
||||
free(sAreas);
|
||||
|
@ -124,11 +124,11 @@ void PackFileBase(void)
|
||||
Syslog('+', "Removed file \"%s\" from area %d", file.LName, i);
|
||||
sprintf(fn, "%s/%s", area.Path, file.LName);
|
||||
rc = unlink(fn);
|
||||
if (rc)
|
||||
if (rc && (errno != ENOENT))
|
||||
Syslog('+', "Unlink %s failed, result %d", fn, rc);
|
||||
sprintf(fn, "%s/%s", area.Path, file.Name);
|
||||
rc = unlink(fn);
|
||||
if (rc)
|
||||
if (rc && (errno != ENOENT))
|
||||
Syslog('+', "Unlink %s failed, result %d", fn, rc);
|
||||
/*
|
||||
* If a dotted version (thumbnail) exists, remove it silently
|
||||
|
Reference in New Issue
Block a user