MUPIP BACKUP returns FILENAMETOOLONG error when backup file path > 255 characters
Final Release Note
NO RELEASE NOTE NEEDED, as this was not an issue in any YottaDB release, and the upstream release note suffices to document the change.
Description
The V6.3-012 change GTM-9182's release note says the following:
MUPIP BACKUP issues FILENAMETOOLONG when the backup file path size exceeds the maximum allowed by GTM, 255 bytes. Previously, MUPIP BACKUP could at least partially execute in spite of file paths that exceeded the maximum length allowed by GTM. (GTM-9182)
In testing for this issue (YDBTest#419 (closed)), we discovered that this error only shows up when a backup file name is specified but not when a directory path is specified. When MUPIP BACKUP runs with a directory path specified, a path of 231 characters or more produces an error due to the GTM-4212 changes from V6.3-003 which return a FILENAMETOOLONG error if the temp file name is too long. Without those changes, MKSTEMP fails with a system level error.
When the database file name is 26 characters (for example mumpsmumpsmumpsmumpsm.dat
which is 26 once MUPIP BACKUP automatically adds the /
), attempting to do a MUPIP BACKUP of that database to a 230 character directory path should produce the %YDB-E-FILENAMETOOLONG
error. In testing, we could not produce this error with a database file name that was mumps
repeated approximately 30 times plus a 230 character path.
After examining the V6.3-012 code change, we found that this is due to the V6.3-012 change (which is clearly labeled as GTM-9182 in a comment) only working when a backup file name (not a backup directory path) is specified. Specifically, the code runs a for loop to find the first /
in the destination-list
argument to MUPIP BACKUP. If it finds a /
, the if block that returns the error is never executed no matter how long the file name is (the if specifically has a check for the index of the first /
being >= the length of the destination-list
argument. Since the destination-list
argument is an absolute or relative path to the directory where the backup should be placed, MUPIP BACKUP will append /[databasename].dat
to the end of this argument. As of V7.0-002, the GTM-9182 code is completely unchanged in upstream.
This code needs to be fixed so that it does what it is supposed to do.
Draft Release Note
MUPIP BACKUP issues FILENAMETOOLONG when the backup file path size exceeds the maximum allowed by YottaDB, 255 bytes. After integrating upstream version V6.3-012 into the YottaDB codebase, we discovered that the upstream fix only works when specifying a file name but does not work if a directory path is specified. We also discovered that the upstream fix did not work for MUPIP BACKUP NOONLINE. In YottaDB, MUPIP BACKUP issues a FILENAMETOOLONG error whenever a buffer would overflow due to a file name that is too long.