gdziadkiewicz commented on code in PR #319:
URL: https://github.com/apache/logging-log4net/pull/319#discussion_r4041950106


##########
src/log4net/Appender/FileAppender.cs:
##########
@@ -1358,6 +1368,40 @@ protected virtual void SetQWForFiles(TextWriter writer)
   /// </remarks>
   protected static string ConvertToFullPath(string path) => 
SystemInfo.ConvertToFullPath(path);
 
+  /// <summary>
+  /// Names the mutex that serialises <paramref name="path"/> between 
processes, with
+  /// <paramref name="suffix"/> telling one mutex over the same file from 
another.
+  /// </summary>
+  /// <remarks>
+  /// The flattened path, as earlier versions computed it. Only a name the 
platform rejects is
+  /// hashed: Unix stops at <see cref="MaxMutexNameLength"/>, Windows has no 
limit. Unprefixed, so
+  /// on Windows it coordinates one session.
+  /// </remarks>
+  internal static string MutexNameForPath(string path, string suffix)
+    => MutexNameForPath(path, suffix, SystemInfo.IsWindows ? null : 
MaxMutexNameLength);
+
+  /// <summary>Takes the limit rather than deciding it, so both branches are 
testable anywhere.</summary>
+  private static string MutexNameForPath(string path, string suffix, int? 
maxLength)
+  {
+    string name = path.EnsureNotNull()
+      .Replace("\\", "_")
+      .Replace(":", "_")
+      .Replace("/", "_") + suffix;
+
+    if (maxLength is null || name.Length <= maxLength)

Review Comment:
   IMO this is reasonable and we should address it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to