Skip to content

Conversation

@liangchenye
Copy link
Member

fix #67
Signed-off-by: liang chenye [email protected]

@liangchenye
Copy link
Member Author

@mrunalp @wking PTAL

@liangchenye liangchenye changed the title fix #67: verify if config is encoded in utf8 test: config is encoded in utf8; cwd is absolute path; env is valid May 18, 2016
@liangchenye liangchenye changed the title test: config is encoded in utf8; cwd is absolute path; env is valid verify: config is encoded in utf8; cwd is absolute path; env is valid May 18, 2016
@liangchenye liangchenye mentioned this pull request May 18, 2016
76 tasks
validate.go Outdated

func checkProcess(process rspec.Process, rootfs string) {
if !path.IsAbs(process.Cwd) {
logrus.Fatalf("Cwd '%s' is not an absolute path", process.Cwd)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use %q instead of '%s'

@liangchenye
Copy link
Member Author

Thanks @mrunalp , updated.

validate.go Outdated
defer sf.Close()

if !utf8.Valid(content) {
logrus.Fatalf("'Config.json' is not encoded in UTF-8")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config.jsonconfig.json for folks on case-sensitive filesystems?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, maybe store the path.Join in a variable, and pass that variable to both ReadFile and this error message.

@liangchenye liangchenye force-pushed the utf8 branch 3 times, most recently from 225565a to 664508c Compare May 19, 2016 08:22
@liangchenye
Copy link
Member Author

@wking @mrunalp Thanks, PR updated according to your comments.

validate.go Outdated
logrus.Fatalf("Cannot find the mount destination %q", rootfsPath)
} else if !fi.IsDir() {
logrus.Fatalf("Mount point: %v is not a directory.", rootfsPath)
logrus.Fatalf("Mount destination %q is not a directory.", rootfsPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It predates this PR, but rootfsPath is a strange name for a variable holding the mount destination.

@wking
Copy link
Contributor

wking commented May 19, 2016

On Thu, May 19, 2016 at 01:24:03AM -0700, 梁辰晔 (Liang Chenye) wrote:

@wking @mrunalp Thanks, PR updated according to your comments.

664508c looks good to me. I think we should rename a variable 1,
but I'm fine with that happening in a follow-up PR.

@liangchenye
Copy link
Member Author

liangchenye commented May 20, 2016

@wking renamed

@wking
Copy link
Contributor

wking commented May 20, 2016

On Thu, May 19, 2016 at 07:50:48PM -0700, 梁辰晔 (Liang Chenye) wrote:

@wking corrected

01c8d1d looks lovely :).

@mrunalp
Copy link
Contributor

mrunalp commented May 20, 2016

LGTM

@mrunalp mrunalp merged commit a637b56 into opencontainers:master May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Where do we enforce UTF-8 JSON?

3 participants