Skip to content

Commit

Permalink
treewide: drop inappropriate executable bits
Browse files Browse the repository at this point in the history
Adjust various spots that set the executable bit on files that cannot
be executed (e.g., bbi.yaml and {model}.out files).

Close #181.
  • Loading branch information
kyleam committed Oct 7, 2024
1 parent b63ceab commit 9546845
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func initializer(cmd *cobra.Command, _ []string) error {
}

// Write the byte array to file
if err = afero.WriteFile(fs, "./bbi.yaml", yamlString, 0755); err != nil {
if err = afero.WriteFile(fs, "./bbi.yaml", yamlString, 0644); err != nil {
return fmt.Errorf("write bbi.yaml: %w", err)
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (l LocalModel) Cleanup(channels *turnstile.ChannelMap) {
// Write to File in original path indicating what all was copied
copiedJSON, _ := json.MarshalIndent(copied, "", " ")

if err = afero.WriteFile(fs, path.Join(l.Nonmem.OriginalPath, l.Nonmem.FileName+"_copied.json"), copiedJSON, 0750); err != nil {
if err = afero.WriteFile(fs, path.Join(l.Nonmem.OriginalPath, l.Nonmem.FileName+"_copied.json"), copiedJSON, 0640); err != nil {
channels.Errors <- turnstile.ConcurrentError{
RunIdentifier: l.Nonmem.FileName,
Notes: "could not write _copied.json file",
Expand Down Expand Up @@ -475,7 +475,7 @@ func executeLocalJob(model *NonMemModel) turnstile.ConcurrentError {
return newConcurrentError(model.Model, "Running the programmatic shell script caused an error", err)
}

if err = afero.WriteFile(fs, path.Join(model.OutputDir, model.Model+".out"), output, 0750); err != nil {
if err = afero.WriteFile(fs, path.Join(model.OutputDir, model.Model+".out"), output, 0640); err != nil {
return turnstile.ConcurrentError{Error: err, Notes: "unable to write model to output directory", RunIdentifier: model.FileName}
}

Expand Down Expand Up @@ -534,7 +534,7 @@ func writeNonmemConfig(model *NonMemModel) error {
return err
}

return afero.WriteFile(afero.NewOsFs(), path.Join(model.OutputDir, "bbi_config.json"), outBytes, 0750)
return afero.WriteFile(afero.NewOsFs(), path.Join(model.OutputDir, "bbi_config.json"), outBytes, 0640)
}

func HashFileOnChannel(ch chan string, file string, identifier string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func logSetup(config configlib.Config) {
var outfile afero.File

if ok, _ := afero.Exists(fs, logfile); ok {
of, err := fs.OpenFile(logfile, os.O_APPEND|os.O_WRONLY, 0755)
of, err := fs.OpenFile(logfile, os.O_APPEND|os.O_WRONLY, 0644)

if err != nil {
log.Fatalf("Unable to open file at %s. Error is %s", logfile, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/sge.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func executeSGEJob(model *NonMemModel) turnstile.ConcurrentError {
}
}

err = afero.WriteFile(fs, path.Join(model.OutputDir, model.Model+".out"), output, 0750)
err = afero.WriteFile(fs, path.Join(model.OutputDir, model.Model+".out"), output, 0640)

if err != nil {
return newConcurrentError(model.Model, "Having issues writing hte output file from command execution", err)
Expand Down
2 changes: 1 addition & 1 deletion configlib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c Config) RenderYamlToFile(path string) error {

targetFile := filepath.Join(path, "bbi.yaml")

err = afero.WriteFile(fs, targetFile, yamlBytes, 0755)
err = afero.WriteFile(fs, targetFile, yamlBytes, 0644)

if err != nil {
log.Error("An error occurred trying to write the serialized config yaml to file")
Expand Down
2 changes: 1 addition & 1 deletion integration/nonmem/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestHasInvalidDataPath(tt *testing.T) {
adjusted := strings.Join(lines, "\n")
ab := []byte(adjusted)

err := os.WriteFile(filepath.Join(scenario.Workpath, m.filename), ab, 0755)
err := os.WriteFile(filepath.Join(scenario.Workpath, m.filename), ab, 0644)

if err != nil {
t.Log("Had a problem writing the file")
Expand Down

0 comments on commit 9546845

Please sign in to comment.