Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
555f5b6b
Commit
555f5b6b
authored
Sep 16, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: make sure path names are canonical
R=ken2 CC=golang-dev
https://golang.org/cl/2209042
parent
fcb24e8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
src/cmd/gc/lex.c
src/cmd/gc/lex.c
+15
-0
No files found.
src/cmd/gc/lex.c
View file @
555f5b6b
...
...
@@ -353,8 +353,11 @@ static int
findpkg
(
Strlit
*
name
)
{
Idir
*
p
;
char
*
q
;
if
(
islocalname
(
name
))
{
if
(
debug
[
'u'
])
return
0
;
// try .a before .6. important for building libraries:
// if there is an array.6 in the array.a library,
// want to find all of array.a, not just array.6.
...
...
@@ -367,6 +370,18 @@ findpkg(Strlit *name)
return
0
;
}
// local imports should be canonicalized already.
// don't want to see "container/../container/vector"
// as different from "container/vector".
q
=
mal
(
name
->
len
+
1
);
memmove
(
q
,
name
->
s
,
name
->
len
);
q
[
name
->
len
]
=
'\0'
;
cleanname
(
q
);
if
(
strlen
(
q
)
!=
name
->
len
||
memcmp
(
q
,
name
->
s
,
name
->
len
)
!=
0
)
{
yyerror
(
"non-canonical import name %Z (%s)"
,
name
->
s
,
q
);
return
0
;
}
for
(
p
=
idirs
;
p
!=
nil
;
p
=
p
->
link
)
{
snprint
(
namebuf
,
sizeof
(
namebuf
),
"%s/%Z.a"
,
p
->
dir
,
name
);
if
(
access
(
namebuf
,
0
)
>=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment