[
https://issues.apache.org/jira/browse/THRIFT-3966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112790#comment-18112790
]
Sylwester Lachiewicz edited comment on THRIFT-3966 at 9/8/26 1:45 PM:
----------------------------------------------------------------------
{{MKDIR}} throws on any failure other than EEXIST
([platform.h:41|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/platform.h#L41]),
the generate path catches it and calls {{failure()}}
([main.cc:1054|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/main.cc#L1054]),
and {{failure()}} writes to stderr and exits 1. A {{gen-py}} that cannot be
created reports the errno and a non-zero exit instead of failing silently.
Resolving as Fixed.
was (Author: slachiewicz):
The compiler validates the output directory up front and reports errors
explicitly ({{check_is_directory()}},
[compiler/cpp/src/thrift/main.cc|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/main.cc]
lines 203-220). Resolving as Fixed.
> Code generation fails silently if user lacks permission to create a directory
> in $CWD
> -------------------------------------------------------------------------------------
>
> Key: THRIFT-3966
> URL: https://issues.apache.org/jira/browse/THRIFT-3966
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Affects Versions: 0.9, 0.9.3
> Reporter: Josh Elser
> Priority: Major
>
> It appears that code generation will fail silently (no error message and a 0
> return code) when the current user does not have permission to create a
> directory in the current working directory (the "gen-XXX" directory for the
> corresponding generated bindings).
> I was able to easily reproduce this by:
> {noformat}
> $ cd /
> $ thrift --gen py /path/to/some/idl.thrift
> $ echo $?
> 0
> $ ls gen-py
> ls: gen-py: No such file or directory
> {noformat}
> I verified this happens on 0.9.0, 0.9.3, and 1.0.0-dev
> (974c99ba38b02288daf05229cdf34e60261d2d01e). I have to assume it also happens
> on 0.9.1 and 0.9.2 but I didn't explicitly verify that.
> Ideally, the user would get a "Permission denied" type of error message and
> we'd see a non-zero exit code for the thrift invocation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)