Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hg-windows-ci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
hg-windows-ci
Commits
6dad422ecc5a
Commit
6dad422ecc5a
authored
10 years ago
by
Matt Mackall
Browse files
Options
Downloads
Patches
Plain Diff
pathauditor: check for Windows shortname aliases
parent
c02a05cc6f5e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mercurial/pathutil.py
+7
-0
7 additions, 0 deletions
mercurial/pathutil.py
tests/test-commit.t
+35
-1
35 additions, 1 deletion
tests/test-commit.t
with
42 additions
and
1 deletion
mercurial/pathutil.py
+
7
−
0
View file @
6dad422e
...
...
@@ -46,6 +46,13 @@
or
_lowerclean
(
parts
[
0
])
in
(
'
.hg
'
,
'
.hg.
'
,
''
)
or
os
.
pardir
in
parts
):
raise
util
.
Abort
(
_
(
"
path contains illegal component: %s
"
)
%
path
)
# Windows shortname aliases
for
p
in
parts
:
if
"
~
"
in
p
:
first
,
last
=
p
.
split
(
"
~
"
,
1
)
if
last
.
isdigit
()
and
first
.
upper
()
in
[
"
HG
"
,
"
HG8B6C
"
]:
raise
util
.
Abort
(
_
(
"
path contains illegal component: %s
"
)
%
path
)
if
'
.hg
'
in
_lowerclean
(
path
):
lparts
=
[
_lowerclean
(
p
.
lower
())
for
p
in
parts
]
for
p
in
'
.hg
'
,
'
.hg.
'
:
...
...
This diff is collapsed.
Click to expand it.
tests/test-commit.t
+
35
−
1
View file @
6dad422e
...
...
@@ -474,4 +474,38 @@
abort:
path
contains
illegal
component:
.
h
\
xe2
\
x80
\
x8cg
/
hgrc
(
esc
)
[
255
]
$
cd
..
$
hg
rollback
-
f
repository
tip
rolled
back
to
revision
1
(
undo
commit
)
$
cat
>
evil
-
commit
.
py
<<
EOF
>
from
mercurial
import
ui
,
hg
,
context
,
node
>
notrc
=
"
HG~1/hgrc
"
>
u
=
ui
.
ui
()
>
r
=
hg
.
repository
(
u
,
'
.
')
>
def
filectxfn
(
repo
,
memctx
,
path
):
>
return
context
.
memfilectx
(
repo
,
path
,
'
[hooks]\nupdate = echo owned
')
>
c
=
context
.
memctx
(
r
,
[
r
['
tip
']
.
node
(),
node
.
nullid
],
>
'
evil
',
[
notrc
],
filectxfn
,
0
)
>
r
.
commitctx
(
c
)
>
EOF
$
$PYTHON
evil
-
commit
.
py
$
hg
co
--
clean
tip
abort:
path
contains
illegal
component:
HG
~
1
/
hgrc
[
255
]
$
hg
rollback
-
f
repository
tip
rolled
back
to
revision
1
(
undo
commit
)
$
cat
>
evil
-
commit
.
py
<<
EOF
>
from
mercurial
import
ui
,
hg
,
context
,
node
>
notrc
=
"
HG8B6C~2/hgrc
"
>
u
=
ui
.
ui
()
>
r
=
hg
.
repository
(
u
,
'
.
')
>
def
filectxfn
(
repo
,
memctx
,
path
):
>
return
context
.
memfilectx
(
repo
,
path
,
'
[hooks]\nupdate = echo owned
')
>
c
=
context
.
memctx
(
r
,
[
r
['
tip
']
.
node
(),
node
.
nullid
],
>
'
evil
',
[
notrc
],
filectxfn
,
0
)
>
r
.
commitctx
(
c
)
>
EOF
$
$PYTHON
evil
-
commit
.
py
$
hg
co
--
clean
tip
abort:
path
contains
illegal
component:
HG8B6C
~
2
/
hgrc
[
255
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment