This will work, but I am thinking of doing as src/common/parse_config.c does and use stat() to get the size we should use. Instead of a hard coded value.

Removing the extra #define in sacctmgr.c is obviously a good catch as well ;).

Thanks,
Danny

On 06/25/2014 05:14 AM, Rémi Palancher wrote:
From: Rémi Palancher <[email protected]>

The macro BUFFER_SIZE used by sacctmgr was set to 4KB. This macro is
used by load_sacctmgr_cfg_file() in src/sacctmgr/file_functions.c to
set the size of the buffer which stores the lines read in dump files
that could be loaded by sacctmgr (notably the ones generated by
`sacctmgr dump`).

This size of 4KB is too small for very long lines that could be present
in theses files. For instance, this bug was encountered with a 236763B
User line full of many WCKeys.

This commit proposes to increase its size to 512KB. This is obviously
not a general solution but it should cover most use cases.

The macro definition is also removed of src/sacctmgr/sacctmgr.c since it
was useless in this file.

Signed-off-by: Rémi Palancher <[email protected]>
---
  src/sacctmgr/sacctmgr.c |    2 --
  src/sacctmgr/sacctmgr.h |    2 +-
  2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/sacctmgr/sacctmgr.c b/src/sacctmgr/sacctmgr.c
index cd27722..1b1af40 100644
--- a/src/sacctmgr/sacctmgr.c
+++ b/src/sacctmgr/sacctmgr.c
@@ -43,8 +43,6 @@
  #include "src/common/xsignal.h"
  #include "src/common/proc_args.h"
-#define BUFFER_SIZE 4096
-
  char *command_name;
  int exit_code;                /* sacctmgr's exit code, =1 on any error at any 
time */
  int exit_flag;                /* program to terminate if =1 */
diff --git a/src/sacctmgr/sacctmgr.h b/src/sacctmgr/sacctmgr.h
index f6068d1..974a3ba 100644
--- a/src/sacctmgr/sacctmgr.h
+++ b/src/sacctmgr/sacctmgr.h
@@ -86,7 +86,7 @@
#define CKPT_WAIT 10
  #define       MAX_INPUT_FIELDS 128
-#define BUFFER_SIZE 4096
+#define BUFFER_SIZE 524288
typedef enum {
        /* COMMON */

Reply via email to