IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 20 years ago

Closed 20 years ago

Last modified 20 years ago

#763 closed defect (fixed)

psError() should strip trailing newline from error strings

Reported by: rhl@… Owned by: David.Robbins@…
Priority: high Milestone:
Component: sys Version: 0.11.0
Severity: normal Keywords:
Cc:

Description

There's lots of code that has \n at the end of its error strings. This makes the traceback
from psErrorStackPrint() harder to read. While we could fix all the user code, it's much
simpler to make p_psError simply strip a single \n at the end of the format. Here's a
patch

* src/sys/psError.c Wed May 24 15:26:56 2006
--- src/sys/psError.c.~1.28.~ Thu Jul 14 22:33:54 2005
*
* 90,101

va_start(argPtr, format);


vsnprintf(errMsg,2048,format,argPtr);

  • Remove a single trailing \n from message -- it interferes with psErrorStackPrint
  • int len = strlen(errMsg);
  • if (len > 0 && errMsg[len - 1] == '\n') {
  • errMsg[len - 1] = '\0'; len--;
  • }

err = psErrAlloc(msgName,code,errMsg);
pushErrorStack(err);


--- 90,95 ----

Change History (3)

comment:1 by Paul Price, 20 years ago

Resolution: fixed
Status: newclosed

I've applied the patch.

BTW, it was generated around the wrong way:

price@mithrandir:/home/mithrandir/price/mhpcc/psLib_rel11>patch -p0 <
~/rhl_psError.patch
patching file src/sys/psError.c
Reversed (or previously applied) patch detected! Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/sys/psError.c.rej
price@mithrandir:/home/mithrandir/price/mhpcc/psLib_rel11>patch -p0 -R <
~/rhl_psError.patch
patching file src/sys/psError.c

comment:2 by Paul Price, 20 years ago

Keywords: VERIFIED added

Bug has been resolved.... closing.

comment:3 by Paul Price, 20 years ago

Keywords: VERIFIED removed

Bugs have been fixed... closing.

Note: See TracTickets for help on using tickets.