bugGNU arch -- a revision control system - Bugs: bug #5640, buildcfg/cfgcat "valid...

 
 

bug #5640: buildcfg/cfgcat "valid name" tests trump "existing file" test

Submitter:  Andrew Suffield <asuffield>
Submitted:  Tue 30 Sep 2003 05:46:12 PM UTC
   
 
Category:  tla Severity:  3 - Normal
Item Group:  small feature idea Status:  None
Privacy:  Public Open/Closed:  Open
Release:  lord@emf.net--2003b/tla--devo--1.1--patch-187
Fixed Release: 
Merge Request?:  yes -- diffs included
Your Archive Name: 
Your Archive Location: 
Assigned to:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 30 Sep 2003 05:46:12 PM UTC, original submission:  

tla cfgcat -s ../../configs/foo

This can't work, because the "valid name" test for configs rejects path components beginning with a period.

As discussed, the trivial fix is to skip the valid name test when it's a valid file. This also involves disabling some invariants which no longer hold.

For -o, I can see no use for the test (and it's been historically broken anyway), so I removed it.

--- orig/libarch/cmd-buildcfg.c
+++ mod/libarch/cmd-buildcfg.c
@@ -129,7 +129,7 @@
 
     config = argv[1];
 
-    if (!arch_valid_config_name (config))
+    if (safe_access (config, F_OK) != 0 && !arch_valid_config_name (config))
       {
         safe_printfmt (2, "%s: invalid config name (%s)\n",
                        argv[0], config);


--- orig/libarch/cmd-cfgcat.c
+++ mod/libarch/cmd-cfgcat.c
@@ -169,17 +169,17 @@
 
     config = argv[1];
 
-    if (!arch_valid_config_name (config))
+    if (safe_access (config, F_OK) != 0 && !arch_valid_config_name (config))
       {
         safe_printfmt (2, "%s: invalid config name (%s)\n", argv[0], config);
         exit (2);
       }
 
-    if (output && !arch_valid_config_name (config))
-      {
-        safe_printfmt (2, "%s: invalid config name (%s)\n", argv[0], output);
-        exit (2);
-      }
+/*     if (output && !arch_valid_config_name (output)) */
+/*       { */
+/*         safe_printfmt (2, "%s: invalid config name (%s)\n", argv[0], output); */
+/*         exit (2); */
+/*       } */
 
     tree_root = arch_tree_root (0, dir, 0);
 


--- orig/libarch/configs.c
+++ mod/libarch/configs.c
@@ -38,14 +38,15 @@
   t_uchar * rel = 0;
   t_uchar * answer = 0;
 
-  invariant (arch_valid_config_name (config_name));
-
-
   rel = file_name_in_vicinity (0, "configs", config_name);
   if (safe_access(rel, F_OK))
     {
       rel = file_name_in_vicinity (0, "", config_name);
     }
+  else
+    {
+      invariant (arch_valid_config_name (config_name));
+    }
   answer = file_name_in_vicinity (0, tree_root, rel);
 
   lim_free (0, rel);
@@ -60,7 +61,7 @@
   int in_fd;
   rel_table answer = 0;
 
-  invariant (arch_valid_config_name (config_name));
+/*   invariant (arch_valid_config_name (config_name)); */
 
   config_path = arch_config_path (tree_root, config_name);
 
@@ -215,7 +216,7 @@
   t_uchar * config_tmp = 0;
   int answer;
 
-  invariant (arch_valid_config_name (name));
+/*   invariant (arch_valid_config_name (name)); */
 
   config_file = arch_config_path (tree_root, name);
   config_dir = file_name_directory_file (0, config_file);
@@ -253,7 +254,7 @@
   t_uchar * tmp_tail = 0;
   t_uchar * config_tmp = 0;
 
-  invariant (arch_valid_config_name (name));
+/*   invariant (arch_valid_config_name (name)); */
 
   config_file = arch_config_path (tree_root, name);
   config_dir = file_name_directory_file (0, config_file);




Andrew Suffield <asuffield>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

No changes have been made to this item

Back to the top

Powered by Savane 3.14-f13d.
Corresponding source code