Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sweep:integration] feat (DMS): DataManager.putAndRegister rejects too long filename #7617

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/DIRAC/DataManagementSystem/Client/DataManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from DIRAC.Core.Utilities.ReturnValues import returnSingleResult
from DIRAC.Core.Security.ProxyInfo import getProxyInfo
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.DataManagementSystem.Client import MAX_FILENAME_LENGTH
from DIRAC.MonitoringSystem.Client.DataOperationSender import DataOperationSender
from DIRAC.DataManagementSystem.Utilities.DMSHelpers import DMSHelpers
from DIRAC.Resources.Catalog.FileCatalog import FileCatalog
Expand Down Expand Up @@ -433,6 +434,9 @@ def putAndRegister(self, lfn, fileName, diracSE, guid=None, path=None, checksum=
'overwrite' removes file from the file catalogue and SE before attempting upload
"""

if len(os.path.basename(lfn)) > MAX_FILENAME_LENGTH:
return S_ERROR(errno.ENAMETOOLONG, f"maximum {MAX_FILENAME_LENGTH} characters allowed")

res = self.__hasAccess("addFile", lfn)
if not res["OK"]:
return res
Expand Down
5 changes: 5 additions & 0 deletions src/DIRAC/DataManagementSystem/Client/FailoverTransfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
temporary replica.

"""

import errno
import time

from DIRAC import S_OK, S_ERROR, gLogger
Expand Down Expand Up @@ -107,6 +109,9 @@ def transferAndRegisterFile(
break
elif cmpError(result, EFCERR):
self.log.debug("transferAndRegisterFile: FC unavailable, retry")
elif cmpError(result, errno.ENAMETOOLONG):
self.log.debug(f"transferAndRegisterFile: this file won't be uploaded: {result}")
return result
elif retryUpload and len(destinationSEList) == 1:
self.log.debug("transferAndRegisterFile: Failed uploading to the only SE, retry")
else:
Expand Down
3 changes: 3 additions & 0 deletions src/DIRAC/DataManagementSystem/Client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
DIRAC.DataManagementSystem.Client package
"""

#: Maximum number of characters for a filename, this should be the same as the FileName column of the DFC
MAX_FILENAME_LENGTH = 128
Loading