From 62d7bce2494f733be15cab3c13884a64d26982d2 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Sun, 4 Dec 2022 17:23:53 +0000 Subject: [PATCH 1/4] feat: adding nobs limit to mp_gitlog --- all.sas | 7 ++++++- base/mp_gitlog.sas | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/all.sas b/all.sas index 398c61fc..708041eb 100644 --- a/all.sas +++ b/all.sas @@ -8352,6 +8352,8 @@ https://documentation.sas.com/doc/ko/pgmsascdc/v_033/lefunctionsref/n1qo5miyvry1 @li commit_time_str the commit_time_num variable cast as string @param [in] mdebug= (0) Set to 1 to enable DEBUG messages + @param [in] nobs= (0) Set to an integer greater than 0 to restrict the number + of rows returned

SAS Macros

@li mf_getgitbranch.sas @@ -8363,7 +8365,7 @@ https://documentation.sas.com/doc/ko/pgmsascdc/v_033/lefunctionsref/n1qo5miyvry1 **/ -%macro mp_gitlog(gitdir,outds=work.mp_gitlog,mdebug=0,filter=BRANCHONLY); +%macro mp_gitlog(gitdir,outds=work.mp_gitlog,mdebug=0,filter=BRANCHONLY,nobs=0); %local varlist i var; %let varlist=author children_ids committer committer_email email id @@ -8405,6 +8407,9 @@ data &outds; if cats(in_current_branch)='TRUE' then output; end; else output; + %if &nobs>0 %then %do; + if n ge &nobs then stop; + %end; end; rc=git_commit_free(trim(gitdir)); keep gitdir branch &varlist message time commit_time_num commit_time_str; diff --git a/base/mp_gitlog.sas b/base/mp_gitlog.sas index 830fc185..434a8fbf 100644 --- a/base/mp_gitlog.sas +++ b/base/mp_gitlog.sas @@ -38,6 +38,8 @@ https://documentation.sas.com/doc/ko/pgmsascdc/v_033/lefunctionsref/n1qo5miyvry1 @li commit_time_str the commit_time_num variable cast as string @param [in] mdebug= (0) Set to 1 to enable DEBUG messages + @param [in] nobs= (0) Set to an integer greater than 0 to restrict the number + of rows returned

SAS Macros

@li mf_getgitbranch.sas @@ -49,7 +51,7 @@ https://documentation.sas.com/doc/ko/pgmsascdc/v_033/lefunctionsref/n1qo5miyvry1 **/ -%macro mp_gitlog(gitdir,outds=work.mp_gitlog,mdebug=0,filter=BRANCHONLY); +%macro mp_gitlog(gitdir,outds=work.mp_gitlog,mdebug=0,filter=BRANCHONLY,nobs=0); %local varlist i var; %let varlist=author children_ids committer committer_email email id @@ -91,6 +93,9 @@ data &outds; if cats(in_current_branch)='TRUE' then output; end; else output; + %if &nobs>0 %then %do; + if n ge &nobs then stop; + %end; end; rc=git_commit_free(trim(gitdir)); keep gitdir branch &varlist message time commit_time_num commit_time_str; From 7edec1ad8aa07bdce4b6c68394094552c299129c Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Sun, 4 Dec 2022 18:18:15 +0000 Subject: [PATCH 2/4] fix: full escaping of syswarningtext and syserrortext. Closes #320 --- all.sas | 228 +++++++++++++++++++++++++++++++-- meta/mm_createwebservice.sas | 38 +++++- meta/mm_webout.sas | 38 +++++- server/ms_createwebservice.sas | 38 +++++- server/ms_webout.sas | 38 +++++- viya/mv_createwebservice.sas | 38 +++++- viya/mv_webout.sas | 38 +++++- 7 files changed, 432 insertions(+), 24 deletions(-) diff --git a/all.sas b/all.sas index 708041eb..82f7a579 100644 --- a/all.sas +++ b/all.sas @@ -16428,7 +16428,24 @@ data _null_; put ' put ",""MF_GETUSER"" : ""%mf_getuser()"" "; '; put ' put ",""SYSCC"" : ""&syscc"" "; '; put ' put ",""SYSENCODING"" : ""&sysencoding"" "; '; - put ' syserrortext=cats(''"'',tranwrd(symget(''syserrortext''),''"'',''\"''),''"''); '; + put ' syserrortext=cats(symget(''syserrortext'')); '; + put ' if findc(syserrortext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syserrortext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -16441,7 +16458,24 @@ data _null_; put ' put ",""SYSUSERID"" : ""&sysuserid"" "; '; put ' sysvlong=quote(trim(symget(''sysvlong''))); '; put ' put '',"SYSVLONG" : '' sysvlong; '; - put ' syswarningtext=cats(''"'',tranwrd(symget(''syswarningtext''),''"'',''\"''),''"''); '; + put ' syswarningtext=cats(symget(''syswarningtext'')); '; + put ' if findc(syswarningtext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syswarningtext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; @@ -20074,7 +20108,24 @@ run; put ",""MF_GETUSER"" : ""%mf_getuser()"" "; put ",""SYSCC"" : ""&syscc"" "; put ",""SYSENCODING"" : ""&sysencoding"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -20087,7 +20138,24 @@ run; put ",""SYSUSERID"" : ""&sysuserid"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; @@ -21438,7 +21506,24 @@ data _null_; put ' put ",""MF_GETUSER"" : ""%mf_getuser()"" "; '; put ' put ",""SYSCC"" : ""&syscc"" "; '; put ' put ",""SYSENCODING"" : ""&sysencoding"" "; '; - put ' syserrortext=cats(''"'',tranwrd(symget(''syserrortext''),''"'',''\"''),''"''); '; + put ' syserrortext=cats(symget(''syserrortext'')); '; + put ' if findc(syserrortext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syserrortext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' SYSHOSTINFOLONG=quote(trim(symget(''SYSHOSTINFOLONG''))); '; put ' put '',"SYSHOSTINFOLONG" : '' SYSHOSTINFOLONG; '; @@ -21454,7 +21539,24 @@ data _null_; put ' put ",""SYSUSERID"" : ""&sysuserid"" "; '; put ' sysvlong=quote(trim(symget(''sysvlong''))); '; put ' put '',"SYSVLONG" : '' sysvlong; '; - put ' syswarningtext=cats(''"'',tranwrd(symget(''syswarningtext''),''"'',''\"''),''"''); '; + put ' syswarningtext=cats(symget(''syswarningtext'')); '; + put ' if findc(syswarningtext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syswarningtext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; @@ -22435,7 +22537,24 @@ run; put ",""MF_GETUSER"" : ""%mf_getuser()"" "; put ",""SYSCC"" : ""&syscc"" "; put ",""SYSENCODING"" : ""&sysencoding"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; put ',"SYSERRORTEXT" : ' syserrortext; SYSHOSTINFOLONG=quote(trim(symget('SYSHOSTINFOLONG'))); put ',"SYSHOSTINFOLONG" : ' SYSHOSTINFOLONG; @@ -22451,7 +22570,24 @@ run; put ",""SYSUSERID"" : ""&sysuserid"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; @@ -24029,7 +24165,24 @@ data _null_; put ' put '',"SYS_JES_JOB_URI" : '' SYS_JES_JOB_URI ; '; put ' put ",""SYSJOBID"" : ""&sysjobid"" "; '; put ' put ",""SYSCC"" : ""&syscc"" "; '; - put ' syserrortext=cats(''"'',tranwrd(symget(''syserrortext''),''"'',''\"''),''"''); '; + put ' syserrortext=cats(symget(''syserrortext'')); '; + put ' if findc(syserrortext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syserrortext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -24042,7 +24195,24 @@ data _null_; put ' put ",""SYSUSERID"" : ""&sysuserid"" "; '; put ' sysvlong=quote(trim(symget(''sysvlong''))); '; put ' put '',"SYSVLONG" : '' sysvlong; '; - put ' syswarningtext=cats(''"'',tranwrd(symget(''syswarningtext''),''"'',''\"''),''"''); '; + put ' syswarningtext=cats(symget(''syswarningtext'')); '; + put ' if findc(syswarningtext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syswarningtext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; @@ -27836,7 +28006,24 @@ filename &fref1 clear; put ',"SYS_JES_JOB_URI" : ' SYS_JES_JOB_URI ; put ",""SYSJOBID"" : ""&sysjobid"" "; put ",""SYSCC"" : ""&syscc"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -27849,7 +28036,24 @@ filename &fref1 clear; put ",""SYSUSERID"" : ""&sysuserid"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; diff --git a/meta/mm_createwebservice.sas b/meta/mm_createwebservice.sas index ba3adf04..93ccf82d 100644 --- a/meta/mm_createwebservice.sas +++ b/meta/mm_createwebservice.sas @@ -571,7 +571,24 @@ data _null_; put ' put ",""MF_GETUSER"" : ""%mf_getuser()"" "; '; put ' put ",""SYSCC"" : ""&syscc"" "; '; put ' put ",""SYSENCODING"" : ""&sysencoding"" "; '; - put ' syserrortext=cats(''"'',tranwrd(symget(''syserrortext''),''"'',''\"''),''"''); '; + put ' syserrortext=cats(symget(''syserrortext'')); '; + put ' if findc(syserrortext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syserrortext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -584,7 +601,24 @@ data _null_; put ' put ",""SYSUSERID"" : ""&sysuserid"" "; '; put ' sysvlong=quote(trim(symget(''sysvlong''))); '; put ' put '',"SYSVLONG" : '' sysvlong; '; - put ' syswarningtext=cats(''"'',tranwrd(symget(''syswarningtext''),''"'',''\"''),''"''); '; + put ' syswarningtext=cats(symget(''syswarningtext'')); '; + put ' if findc(syswarningtext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syswarningtext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; diff --git a/meta/mm_webout.sas b/meta/mm_webout.sas index 7904f864..8c419b9b 100644 --- a/meta/mm_webout.sas +++ b/meta/mm_webout.sas @@ -175,7 +175,24 @@ put ",""MF_GETUSER"" : ""%mf_getuser()"" "; put ",""SYSCC"" : ""&syscc"" "; put ",""SYSENCODING"" : ""&sysencoding"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -188,7 +205,24 @@ put ",""SYSUSERID"" : ""&sysuserid"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; diff --git a/server/ms_createwebservice.sas b/server/ms_createwebservice.sas index a8dcc44d..54b3daef 100644 --- a/server/ms_createwebservice.sas +++ b/server/ms_createwebservice.sas @@ -560,7 +560,24 @@ data _null_; put ' put ",""MF_GETUSER"" : ""%mf_getuser()"" "; '; put ' put ",""SYSCC"" : ""&syscc"" "; '; put ' put ",""SYSENCODING"" : ""&sysencoding"" "; '; - put ' syserrortext=cats(''"'',tranwrd(symget(''syserrortext''),''"'',''\"''),''"''); '; + put ' syserrortext=cats(symget(''syserrortext'')); '; + put ' if findc(syserrortext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syserrortext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' SYSHOSTINFOLONG=quote(trim(symget(''SYSHOSTINFOLONG''))); '; put ' put '',"SYSHOSTINFOLONG" : '' SYSHOSTINFOLONG; '; @@ -576,7 +593,24 @@ data _null_; put ' put ",""SYSUSERID"" : ""&sysuserid"" "; '; put ' sysvlong=quote(trim(symget(''sysvlong''))); '; put ' put '',"SYSVLONG" : '' sysvlong; '; - put ' syswarningtext=cats(''"'',tranwrd(symget(''syswarningtext''),''"'',''\"''),''"''); '; + put ' syswarningtext=cats(symget(''syswarningtext'')); '; + put ' if findc(syswarningtext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syswarningtext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; diff --git a/server/ms_webout.sas b/server/ms_webout.sas index 1b44e64b..9fbbef14 100644 --- a/server/ms_webout.sas +++ b/server/ms_webout.sas @@ -162,7 +162,24 @@ put ",""MF_GETUSER"" : ""%mf_getuser()"" "; put ",""SYSCC"" : ""&syscc"" "; put ",""SYSENCODING"" : ""&sysencoding"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; put ',"SYSERRORTEXT" : ' syserrortext; SYSHOSTINFOLONG=quote(trim(symget('SYSHOSTINFOLONG'))); put ',"SYSHOSTINFOLONG" : ' SYSHOSTINFOLONG; @@ -178,7 +195,24 @@ put ",""SYSUSERID"" : ""&sysuserid"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; diff --git a/viya/mv_createwebservice.sas b/viya/mv_createwebservice.sas index e7573ecc..e25105c3 100644 --- a/viya/mv_createwebservice.sas +++ b/viya/mv_createwebservice.sas @@ -743,7 +743,24 @@ data _null_; put ' put '',"SYS_JES_JOB_URI" : '' SYS_JES_JOB_URI ; '; put ' put ",""SYSJOBID"" : ""&sysjobid"" "; '; put ' put ",""SYSCC"" : ""&syscc"" "; '; - put ' syserrortext=cats(''"'',tranwrd(symget(''syserrortext''),''"'',''\"''),''"''); '; + put ' syserrortext=cats(symget(''syserrortext'')); '; + put ' if findc(syserrortext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syserrortext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -756,7 +773,24 @@ data _null_; put ' put ",""SYSUSERID"" : ""&sysuserid"" "; '; put ' sysvlong=quote(trim(symget(''sysvlong''))); '; put ' put '',"SYSVLONG" : '' sysvlong; '; - put ' syswarningtext=cats(''"'',tranwrd(symget(''syswarningtext''),''"'',''\"''),''"''); '; + put ' syswarningtext=cats(symget(''syswarningtext'')); '; + put ' if findc(syswarningtext,''"\''!!''0A0D09000E0F010210111A''x) then do; '; + put ' syswarningtext=''"''!!trim( '; + put ' prxchange(''s/"/\\"/'',-1, /* double quote */ '; + put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ '; + put ' prxchange(''s/\x0D/\r/'',-1, /* carriage return */ '; + put ' prxchange(''s/\x09/\\t/'',-1, /* tab */ '; + put ' prxchange(''s/\x00/\\u0000/'',-1, /* NUL */ '; + put ' prxchange(''s/\x0E/\\u000E/'',-1, /* SS */ '; + put ' prxchange(''s/\x0F/\\u000F/'',-1, /* SF */ '; + put ' prxchange(''s/\x01/\\u0001/'',-1, /* SOH */ '; + put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ '; + put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ '; + put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ '; + put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ '; + put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; + put ' )))))))))))))!!''"''; '; + put ' end; '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; diff --git a/viya/mv_webout.sas b/viya/mv_webout.sas index 78611a10..2b899b4e 100644 --- a/viya/mv_webout.sas +++ b/viya/mv_webout.sas @@ -204,7 +204,24 @@ put ',"SYS_JES_JOB_URI" : ' SYS_JES_JOB_URI ; put ",""SYSJOBID"" : ""&sysjobid"" "; put ",""SYSCC"" : ""&syscc"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -217,7 +234,24 @@ put ",""SYSUSERID"" : ""&sysuserid"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; From 19eb348f0ed0ad43bbfc917ef3096478ababbafc Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Sun, 4 Dec 2022 18:59:31 +0000 Subject: [PATCH 3/4] fix: else case for issue #320 --- all.sas | 12 ++++++++++++ meta/mm_createwebservice.sas | 2 ++ meta/mm_webout.sas | 2 ++ server/ms_createwebservice.sas | 2 ++ server/ms_webout.sas | 2 ++ viya/mv_createwebservice.sas | 2 ++ viya/mv_webout.sas | 2 ++ 7 files changed, 24 insertions(+) diff --git a/all.sas b/all.sas index 82f7a579..5fc6b1bb 100644 --- a/all.sas +++ b/all.sas @@ -16446,6 +16446,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syserrortext=cats(''"'',syserrortext,''"''); '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -16476,6 +16477,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syswarningtext=cats(''"'',syswarningtext,''"''); '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; @@ -20126,6 +20128,7 @@ run; prxchange('s/\\/\\\\/',-1,syserrortext) )))))))))))))!!'"'; end; + else syserrortext=cats('"',syserrortext,'"'); put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -20156,6 +20159,7 @@ run; prxchange('s/\\/\\\\/',-1,syswarningtext) )))))))))))))!!'"'; end; + else syswarningtext=cats('"',syswarningtext,'"'); put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; @@ -21524,6 +21528,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syserrortext=cats(''"'',syserrortext,''"''); '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' SYSHOSTINFOLONG=quote(trim(symget(''SYSHOSTINFOLONG''))); '; put ' put '',"SYSHOSTINFOLONG" : '' SYSHOSTINFOLONG; '; @@ -21557,6 +21562,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syswarningtext=cats(''"'',syswarningtext,''"''); '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; @@ -22555,6 +22561,7 @@ run; prxchange('s/\\/\\\\/',-1,syserrortext) )))))))))))))!!'"'; end; + else syserrortext=cats('"',syserrortext,'"'); put ',"SYSERRORTEXT" : ' syserrortext; SYSHOSTINFOLONG=quote(trim(symget('SYSHOSTINFOLONG'))); put ',"SYSHOSTINFOLONG" : ' SYSHOSTINFOLONG; @@ -22588,6 +22595,7 @@ run; prxchange('s/\\/\\\\/',-1,syswarningtext) )))))))))))))!!'"'; end; + else syswarningtext=cats('"',syswarningtext,'"'); put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; @@ -24183,6 +24191,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syserrortext=cats(''"'',syserrortext,''"''); '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -24213,6 +24222,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syswarningtext=cats(''"'',syswarningtext,''"''); '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; @@ -28024,6 +28034,7 @@ filename &fref1 clear; prxchange('s/\\/\\\\/',-1,syserrortext) )))))))))))))!!'"'; end; + else syserrortext=cats('"',syserrortext,'"'); put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -28054,6 +28065,7 @@ filename &fref1 clear; prxchange('s/\\/\\\\/',-1,syswarningtext) )))))))))))))!!'"'; end; + else syswarningtext=cats('"',syswarningtext,'"'); put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; diff --git a/meta/mm_createwebservice.sas b/meta/mm_createwebservice.sas index 93ccf82d..c1439b55 100644 --- a/meta/mm_createwebservice.sas +++ b/meta/mm_createwebservice.sas @@ -589,6 +589,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syserrortext=cats(''"'',syserrortext,''"''); '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -619,6 +620,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syswarningtext=cats(''"'',syswarningtext,''"''); '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; diff --git a/meta/mm_webout.sas b/meta/mm_webout.sas index 8c419b9b..98877383 100644 --- a/meta/mm_webout.sas +++ b/meta/mm_webout.sas @@ -193,6 +193,7 @@ prxchange('s/\\/\\\\/',-1,syserrortext) )))))))))))))!!'"'; end; + else syserrortext=cats('"',syserrortext,'"'); put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -223,6 +224,7 @@ prxchange('s/\\/\\\\/',-1,syswarningtext) )))))))))))))!!'"'; end; + else syswarningtext=cats('"',syswarningtext,'"'); put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; diff --git a/server/ms_createwebservice.sas b/server/ms_createwebservice.sas index 54b3daef..82dc54c8 100644 --- a/server/ms_createwebservice.sas +++ b/server/ms_createwebservice.sas @@ -578,6 +578,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syserrortext=cats(''"'',syserrortext,''"''); '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' SYSHOSTINFOLONG=quote(trim(symget(''SYSHOSTINFOLONG''))); '; put ' put '',"SYSHOSTINFOLONG" : '' SYSHOSTINFOLONG; '; @@ -611,6 +612,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syswarningtext=cats(''"'',syswarningtext,''"''); '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; diff --git a/server/ms_webout.sas b/server/ms_webout.sas index 9fbbef14..be3f87d9 100644 --- a/server/ms_webout.sas +++ b/server/ms_webout.sas @@ -180,6 +180,7 @@ prxchange('s/\\/\\\\/',-1,syserrortext) )))))))))))))!!'"'; end; + else syserrortext=cats('"',syserrortext,'"'); put ',"SYSERRORTEXT" : ' syserrortext; SYSHOSTINFOLONG=quote(trim(symget('SYSHOSTINFOLONG'))); put ',"SYSHOSTINFOLONG" : ' SYSHOSTINFOLONG; @@ -213,6 +214,7 @@ prxchange('s/\\/\\\\/',-1,syswarningtext) )))))))))))))!!'"'; end; + else syswarningtext=cats('"',syswarningtext,'"'); put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; diff --git a/viya/mv_createwebservice.sas b/viya/mv_createwebservice.sas index e25105c3..e7dc86d9 100644 --- a/viya/mv_createwebservice.sas +++ b/viya/mv_createwebservice.sas @@ -761,6 +761,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syserrortext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syserrortext=cats(''"'',syserrortext,''"''); '; put ' put '',"SYSERRORTEXT" : '' syserrortext; '; put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; '; put ' put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; '; @@ -791,6 +792,7 @@ data _null_; put ' prxchange(''s/\\/\\\\/'',-1,syswarningtext) '; put ' )))))))))))))!!''"''; '; put ' end; '; + put ' else syswarningtext=cats(''"'',syswarningtext,''"''); '; put ' put '',"SYSWARNINGTEXT" : '' syswarningtext; '; put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),E8601DT26.6)" ''" ''; '; put ' length memsize $32; '; diff --git a/viya/mv_webout.sas b/viya/mv_webout.sas index 2b899b4e..6a5c7e37 100644 --- a/viya/mv_webout.sas +++ b/viya/mv_webout.sas @@ -222,6 +222,7 @@ prxchange('s/\\/\\\\/',-1,syserrortext) )))))))))))))!!'"'; end; + else syserrortext=cats('"',syserrortext,'"'); put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSPROCESSID"" : ""&SYSPROCESSID"" "; @@ -252,6 +253,7 @@ prxchange('s/\\/\\\\/',-1,syswarningtext) )))))))))))))!!'"'; end; + else syswarningtext=cats('"',syswarningtext,'"'); put ',"SYSWARNINGTEXT" : ' syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; length memsize $32; From b7afecdf81e1dd69592ee18e73d8387de987ad38 Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Sun, 4 Dec 2022 21:14:10 +0000 Subject: [PATCH 4/4] fix: escaping syswarningtext and syserrortext in mp_abort --- all.sas | 42 +++++++++++++++++++++++++++++++++++++++--- base/mp_abort.sas | 42 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 6 deletions(-) diff --git a/all.sas b/all.sas index 5fc6b1bb..d8a6721e 100644 --- a/all.sas +++ b/all.sas @@ -2542,15 +2542,51 @@ and %superq(SYSPROCESSNAME) ne %str(Compute Server) _PROGRAM=quote(trim(resolve(symget('_PROGRAM')))); put ',"_PROGRAM" : ' _PROGRAM ; put ",""SYSCC"" : ""&syscc"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); - put ",""SYSERRORTEXT"" : " syserrortext; + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; + else syserrortext=cats('"',syserrortext,'"'); + put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSJOBID"" : ""&sysjobid"" "; put ",""SYSSCPL"" : ""&sysscpl"" "; put ",""SYSSITE"" : ""&syssite"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; + else syswarningtext=cats('"',syswarningtext,'"'); put ",""SYSWARNINGTEXT"" : " syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; put "}" ; diff --git a/base/mp_abort.sas b/base/mp_abort.sas index f88e6318..719e26c8 100644 --- a/base/mp_abort.sas +++ b/base/mp_abort.sas @@ -225,15 +225,51 @@ and %superq(SYSPROCESSNAME) ne %str(Compute Server) _PROGRAM=quote(trim(resolve(symget('_PROGRAM')))); put ',"_PROGRAM" : ' _PROGRAM ; put ",""SYSCC"" : ""&syscc"" "; - syserrortext=cats('"',tranwrd(symget('syserrortext'),'"','\"'),'"'); - put ",""SYSERRORTEXT"" : " syserrortext; + syserrortext=cats(symget('syserrortext')); + if findc(syserrortext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syserrortext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syserrortext) + )))))))))))))!!'"'; + end; + else syserrortext=cats('"',syserrortext,'"'); + put ',"SYSERRORTEXT" : ' syserrortext; put ",""SYSHOSTNAME"" : ""&syshostname"" "; put ",""SYSJOBID"" : ""&sysjobid"" "; put ",""SYSSCPL"" : ""&sysscpl"" "; put ",""SYSSITE"" : ""&syssite"" "; sysvlong=quote(trim(symget('sysvlong'))); put ',"SYSVLONG" : ' sysvlong; - syswarningtext=cats('"',tranwrd(symget('syswarningtext'),'"','\"'),'"'); + syswarningtext=cats(symget('syswarningtext')); + if findc(syswarningtext,'"\'!!'0A0D09000E0F010210111A'x) then do; + syswarningtext='"'!!trim( + prxchange('s/"/\\"/',-1, /* double quote */ + prxchange('s/\x0A/\n/',-1, /* new line */ + prxchange('s/\x0D/\r/',-1, /* carriage return */ + prxchange('s/\x09/\\t/',-1, /* tab */ + prxchange('s/\x00/\\u0000/',-1, /* NUL */ + prxchange('s/\x0E/\\u000E/',-1, /* SS */ + prxchange('s/\x0F/\\u000F/',-1, /* SF */ + prxchange('s/\x01/\\u0001/',-1, /* SOH */ + prxchange('s/\x02/\\u0002/',-1, /* STX */ + prxchange('s/\x10/\\u0010/',-1, /* DLE */ + prxchange('s/\x11/\\u0011/',-1, /* DC1 */ + prxchange('s/\x1A/\\u001A/',-1, /* SUB */ + prxchange('s/\\/\\\\/',-1,syswarningtext) + )))))))))))))!!'"'; + end; + else syswarningtext=cats('"',syswarningtext,'"'); put ",""SYSWARNINGTEXT"" : " syswarningtext; put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" '; put "}" ;