Summary:
How many times has no one else been able to use your awesome Python script
because the Thrift generated files are in a directory that they can't access?
Never again! We now create directories with mode 0777.
Of course, your process umask will ensure that they are actually created
with mode 0755. (This is how the mkdir command works.)
Reviewed By: mcslee
Test Plan:
Rebuilt thrift, then did this:
dreiss@dreiss-vmware:dir_mode:thrift/test$ rm -rf gen-*
dreiss@dreiss-vmware:dir_mode:thrift/test$ thrift -cpp -java -php -py ThriftTest.thrift
dreiss@dreiss-vmware:dir_mode:thrift/test$ ls -ld gen-*
drwx------ 2 dreiss dreiss 4096 2007-10-18 12:20 gen-cpp
drwx------ 3 dreiss dreiss 4096 2007-10-18 12:20 gen-java
drwx------ 2 dreiss dreiss 4096 2007-10-18 12:20 gen-php
drwx------ 3 dreiss dreiss 4096 2007-10-18 12:20 gen-py
dreiss@dreiss-vmware:dir_mode:thrift/test$ rm -rf gen-*
dreiss@dreiss-vmware:dir_mode:thrift/test$ ../compiler/cpp/thrift -cpp -java -php -py ThriftTest.thrift
dreiss@dreiss-vmware:dir_mode:thrift/test$ ls -ld gen-*
drwxr-xr-x 2 dreiss dreiss 4096 2007-10-18 12:20 gen-cpp
drwxr-xr-x 3 dreiss dreiss 4096 2007-10-18 12:20 gen-java
drwxr-xr-x 2 dreiss dreiss 4096 2007-10-18 12:20 gen-php
drwxr-xr-x 3 dreiss dreiss 4096 2007-10-18 12:20 gen-py
dreiss@dreiss-vmware:dir_mode:thrift/test$
Revert Plan: ok
Other Notes:
With some help from external contributor Ben Maurer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665317
13f79535-47bb-0310-9956-
ffa450edef68
*/
void t_cocoa_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
cocoa_prefix_ = program_->get_cocoa_prefix();
// we have a .h header file...
*/
void t_cpp_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
// Make output file
string f_types_name = get_out_dir()+program_name_+"_types.h";
*/
void t_erl_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
// setup export lines
export_lines_first_ = true;
*/
void t_hs_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
// Make output file
*/
void t_java_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
package_name_ = program_->get_java_package();
string dir = package_name_;
string::size_type loc;
while ((loc = dir.find(".")) != string::npos) {
subdir = subdir + "/" + dir.substr(0, loc);
- mkdir(subdir.c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(subdir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
dir = dir.substr(loc+1);
}
if (dir.size() > 0) {
subdir = subdir + "/" + dir;
- mkdir(subdir.c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(subdir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
}
package_dir_ = subdir;
*/
void t_ocaml_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
// Make output file
string f_types_name = get_out_dir()+program_name_+"_types.ml";
*/
void t_perl_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
string outdir = get_out_dir();
std::string ns = program_->get_perl_package();
if (ns.length() > 0) {
outdir += ns + "/";
- mkdir(outdir.c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(outdir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
}
// Make output file
*/
void t_php_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
// Make output file
string f_types_name = get_out_dir()+program_name_+"_types.php";
package_dir_ = get_out_dir();
while (true) {
// TODO: Do better error checking here.
- mkdir(package_dir_.c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(package_dir_.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
std::ofstream init_py((package_dir_+"/__init__.py").c_str());
init_py.close();
if (module.empty()) {
*/
void t_rb_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
// Make output file
string f_types_name = get_out_dir()+program_name_+"_types.rb";
void t_xsd_generator::init_generator() {
// Make output directory
- mkdir(get_out_dir().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
+ mkdir(get_out_dir().c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
// Make output file
string f_php_name = get_out_dir()+program_->get_name()+"_xsd.php";