[PATCH] D52728: [XRay] Remove a path-length limitation

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 09:03:43 PDT 2018


jmorse created this revision.
jmorse added reviewers: dberris, MaskRay.
Herald added subscribers: Sanitizers, llvm-commits.

Hi Dean et al,

Could we please remove the path length limitation referred to in this patch -- the path-to and binary-name of xray logfiles are implicitly truncated to 128 chars each. We've run into some (localized) trouble:

- r343295 [0] caused the path that an xray logfile is written to, for one test, to be substantially longer
- The log-file-opening code effectively limits the path to xray logfiles to ~128 characters
- On our local test setup, the path ends up being 135 characters.
- This kills the test

The net effect of the "HalfLength" limitation is that fdr-thread-order.cc writes its logfile in a higher level directory, later failing the test because the output can't be found. The purpose of this limitation isn't clear to me, and it seems much more beneficial to let, on error, the code fall through to the "name too long" code path, which reports something useful instead of silently dropping a file somewhere else.

[0] https://reviews.llvm.org/rL343295


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D52728

Files:
  llvm/projects/compiler-rt/lib/xray/xray_utils.cc


Index: llvm/projects/compiler-rt/lib/xray/xray_utils.cc
===================================================================
--- llvm/projects/compiler-rt/lib/xray/xray_utils.cc
+++ llvm/projects/compiler-rt/lib/xray/xray_utils.cc
@@ -103,10 +103,9 @@
   if (LastSlash != nullptr)
     Progname = LastSlash + 1;
 
-  const int HalfLength = sizeof(TmpFilename) / 2 - sizeof(TmpWildcardPattern);
   int NeededLength = internal_snprintf(
-      TmpFilename, sizeof(TmpFilename), "%.*s%.*s.%s", HalfLength,
-      flags()->xray_logfile_base, HalfLength, Progname, TmpWildcardPattern);
+      TmpFilename, sizeof(TmpFilename), "%s%s.%s",
+      flags()->xray_logfile_base, Progname, TmpWildcardPattern);
   if (NeededLength > int(sizeof(TmpFilename))) {
     Report("XRay log file name too long (%d): %s\n", NeededLength, TmpFilename);
     return -1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52728.167747.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181001/dd7b1777/attachment.bin>


More information about the llvm-commits mailing list