View Issue Details

IDProjectCategoryView StatusLast Update
0000693XdebugUncategorizedpublic2016-12-23 21:26
Reporterrelaxnow Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Platformx86OSCentOSOS Version5.6
Summary0000693: Profiling: cachegrind files not written when filename exceeds 260 characters
Description

When the '%R' option is used for the output name and the request URI exceeds 260 characters XDebug doesn't output a cachegrind file or even log an error.

Steps To Reproduce
  1. Set up XDebug, enable profiling.
  2. Use the following INI settings:
    xdebug.profiler_enable = 1
    xdebug.profiler_output_name = cachegrind.out.%H.%R
  3. Go to a long url (I used ??11111111111111111111111111111222222222222222222222222222222233333333333333333333333344444444444444444444444444444444444455555555555555555555555555555566666666666666666666666666666666666667777777777777777777777777778888901234)
  4. Go to the output directory, expect to see a cachegrind.out file.
Additional Information

Attached is a patch made on a checkout of revision 3440 of trunk.
This is my first C code ever, so it's probably too naive, but it does seem to fix the bug by truncating the filename to NAME_MAX.
Let me know how I can help (had fun messing with C).

TagsNo tags attached.
Attached Files
xdebug.rev3440.profiling-long-filename.patch (582 bytes)   
Index: xdebug_profiler.c
===================================================================
--- xdebug_profiler.c	(revision 3440)
+++ xdebug_profiler.c	(working copy)
@@ -26,6 +26,7 @@
 #include "xdebug_str.h"
 #include "xdebug_var.h"
 #include "usefulstuff.h"
+#include "limits.h"
 #ifdef PHP_WIN32
 #include <process.h>
 #endif
@@ -66,6 +67,9 @@
 		/* Invalid or empty xdebug.profiler_output_name */
 		return FAILURE;
 	}
+	if (strlen(fname) > NAME_MAX) {
+		fname[NAME_MAX] = '\0';
+	}
 	filename = xdebug_sprintf("%s/%s", XG(profiler_output_dir), fname);
 	xdfree(fname);
 		
Operating System
PHP Version5.3.3

Relationships

has duplicate 0000604 resolvedderick profiler_output_name: Using %R causes no output on some requests 

Activities

derick

2011-08-13 18:03

administrator   ~0001781

Fixed for 2.1.3 and 2.2.

relaxnow

2011-10-12 06:56

reporter   ~0001842

Tested this with current master from GitHub (https://github.com/derickr/xdebug/commit/00a00ea4512d414f0592675a7c91f5791868eb1a), was not fixed, applying the patch still fixed it.

derick

2016-11-28 21:28

administrator   ~0003828

I still can't reproduce this. Is this still causing an issue for you?

derick

2016-12-23 21:26

administrator   ~0004100

Closing this, as the requested feedback whether it's still a problem wasn't answered. Please reopen this issue if necessary.

Issue History

Date Modified Username Field Change
2011-05-14 16:26 relaxnow New Issue
2011-05-14 16:26 relaxnow File Added: xdebug.rev3440.profiling-long-filename.patch
2011-08-13 18:03 derick Note Added: 0001781
2011-08-13 18:03 derick Status new => closed
2011-08-13 18:03 derick Assigned To => derick
2011-08-13 18:03 derick Resolution open => fixed
2011-08-17 18:44 derick Relationship added has duplicate 0000604
2011-10-12 06:56 relaxnow Note Added: 0001842
2011-10-12 06:56 relaxnow Status closed => feedback
2011-10-12 06:56 relaxnow Resolution fixed => reopened
2012-03-12 16:46 derick Target Version => 2.2.1
2012-07-14 22:14 derick Target Version 2.2.1 => 2.2.2
2013-03-23 14:50 derick Target Version 2.2.2 => 2.2.3
2013-05-22 03:51 derick Target Version 2.2.3 => 2.2.x
2014-03-05 09:21 derick Status feedback => assigned
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2016-11-28 21:28 derick Note Added: 0003828
2016-11-28 21:28 derick Status assigned => feedback
2016-12-23 21:26 derick Note Added: 0004100
2016-12-23 21:26 derick Status feedback => resolved
2016-12-23 21:26 derick Resolution reopened => no change required
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized