Opened 8 years ago

Closed 7 years ago

#4854 closed (fixed)

backslashes not required on windows

Reported by: anonymous Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: path backslash
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

apache installation manual says
If you’re using Windows, remember that the path will contain backslashes. This string is passed through Python’s string parser twice, so you need to escape each backslash twice:

PythonPath "c:\\\\path\\\\to\\\\project? + sys.path"

Or, use raw strings:

PythonPath "[r'c:
path
to
project'] + sys.path"

but forward slashes work just fine here on windows and is less confusing than

, just remind them that forward slashes are preferred and to not try to figure out the

pattern.

Attachments (1)

4854.diff (838 bytes) - added by adamv 7 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 follow-up: Changed 8 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Assuming that the string is parsed twice, you should be double-escaping your path. It may just be coincidence that you haven't caused an error because you aren't using escapable characters.

For example, c:\path\here would be fine, but c:\path\to\here wouldn't be.

>>> 'c:\path\here'
'c:\\path\\here'
>>> 'c:\path\to\here'
'c:\\path\to\\here'

comment:2 in reply to: ↑ 1 Changed 8 years ago by John Shaffer <jshaffer2112@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to SmileyChris:

The reporter is recommending forward slashes, not unescaped backslashes.

comment:3 Changed 8 years ago by SmileyChris

  • Triage Stage changed from Unreviewed to Design decision needed

John, so they are. I'll promote do Design Decision

Changed 7 years ago by adamv

comment:4 Changed 7 years ago by adamv

  • Has patch set

Forward slashes are expected on Windows for Apache's built-in directives, so it makes sense to recommend them here as well.

comment:5 Changed 7 years ago by SmileyChris

  • Triage Stage changed from Design decision needed to Ready for checkin

Elsewhere (settings) we recommend using forward slashes, so I guess we should do that everywhere. Simple is good.

comment:6 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [6536]) Fixed #4854 -- Recommended the use of forward slashes even in Windows configuration, to avoid having to worry about double-escaping issues. Based on a patch from adamv.

Note: See TracTickets for help on using tickets.
Back to Top