From 98930eebc442757a81fda2bc92e94132f7dc87a6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 3 Mar 2018 00:12:59 -0600 Subject: [PATCH 01/15] strcpy() -> strncpy() changes from Bruce Hill Also added some additional static assertions for string field sizes. --- src/std/rec/stringinRecord.c | 5 +++-- src/std/rec/stringoutRecord.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/std/rec/stringinRecord.c b/src/std/rec/stringinRecord.c index 19f55866a..db2f626f1 100644 --- a/src/std/rec/stringinRecord.c +++ b/src/std/rec/stringinRecord.c @@ -93,6 +93,7 @@ static long readValue(stringinRecord *); static long init_record(stringinRecord *prec, int pass) { STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val)); + STATIC_ASSERT(sizeof(prec->sval)==sizeof(prec->val)); struct stringindset *pdset; long status; @@ -119,7 +120,7 @@ static long init_record(stringinRecord *prec, int pass) if( pdset->init_record ) { if((status=(*pdset->init_record)(prec))) return(status); } - strcpy(prec->oval,prec->val); + strncpy(prec->oval, prec->val, sizeof(prec->val)); return(0); } @@ -193,7 +194,7 @@ static long readValue(stringinRecord *prec) status=dbGetLink(&(prec->siol),DBR_STRING, prec->sval,0,0); if (status==0) { - strcpy(prec->val,prec->sval); + strncpy(prec->val, prec->sval, sizeof(prec->val)); prec->udf=FALSE; } } else { diff --git a/src/std/rec/stringoutRecord.c b/src/std/rec/stringoutRecord.c index ea9012911..2bca3228c 100644 --- a/src/std/rec/stringoutRecord.c +++ b/src/std/rec/stringoutRecord.c @@ -95,6 +95,7 @@ static long writeValue(stringoutRecord *); static long init_record(stringoutRecord *prec, int pass) { STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val)); + STATIC_ASSERT(sizeof(prec->ivov)==sizeof(prec->val)); struct stringoutdset *pdset; long status=0; @@ -121,7 +122,7 @@ static long init_record(stringoutRecord *prec, int pass) if( pdset->init_record ) { if((status=(*pdset->init_record)(prec))) return(status); } - strcpy(prec->oval,prec->val); + strncpy(prec->oval, prec->val, sizeof(prec->val)); return(0); } @@ -159,7 +160,7 @@ static long process(stringoutRecord *prec) break; case (menuIvoaSet_output_to_IVOV) : if(prec->pact == FALSE){ - strcpy(prec->val,prec->ivov); + strncpy(prec->val, prec->ivov, sizeof(prec->val)); } status=writeValue(prec); /* write the new value */ break; From 8eb4eec7d28eaa8950be95b05cfd551897b4b69a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 3 Mar 2018 17:17:34 -0600 Subject: [PATCH 02/15] Corrected fix from Bruce Hill's Github PR#19 --- configure/RULES_BUILD | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 6d2a5cd55..1b7e5dc25 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -170,8 +170,9 @@ ifdef RES @$(RM) *$(RES) endif -$(DIRECTORY_TARGETS) : - $(MKDIR) -p $@ +# Sort mkdir targets to remove duplicates & make parents first +$(DIRECTORY_TARGETS): + $(MKDIR) $(sort $@) # Install LIB_INSTALLS libraries before linking executables $(TESTPRODNAME) $(PRODNAME): | $(INSTALL_LIB_INSTALLS) From 98d9ea45451e43125d3b3eb3da31b48afa1b9cbc Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 4 Mar 2018 15:45:15 -0600 Subject: [PATCH 03/15] ca/client: Catch by reference, missing '&' --- src/ca/client/oldChannelNotify.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ca/client/oldChannelNotify.cpp b/src/ca/client/oldChannelNotify.cpp index 5775bcc6b..701f51fc1 100644 --- a/src/ca/client/oldChannelNotify.cpp +++ b/src/ca/client/oldChannelNotify.cpp @@ -390,7 +390,7 @@ int epicsShareAPI ca_array_get_callback ( chtype type, { caStatus = ECA_ALLOCMEM; } - catch ( cacChannel::msgBodyCacheTooSmall ) { + catch ( cacChannel::msgBodyCacheTooSmall & ) { caStatus = ECA_TOLARGE; } catch ( ... ) From a9764c8f62ca49150c6bc1e68777b011b50e5604 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 4 Mar 2018 15:51:39 -0600 Subject: [PATCH 04/15] tools/caput: Report errors from ca_array_put*() Fixes LP: #1747983 --- src/ca/client/tools/caput.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ca/client/tools/caput.c b/src/ca/client/tools/caput.c index 9c50cd9df..5e4d10e23 100644 --- a/src/ca/client/tools/caput.c +++ b/src/ca/client/tools/caput.c @@ -8,7 +8,7 @@ * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -419,7 +419,7 @@ int main (int argc, char *argv[]) if (argc > optind+1) { for (i = optind + 1; i < argc; i++) { strcat(cbuf, " "); - strcat(cbuf, argv[i]); + strcat(cbuf, argv[i]); } } @@ -530,6 +530,11 @@ int main (int argc, char *argv[]) /* Use standard put with defined timeout */ result = ca_array_put (dbrType, count, pvs[0].chid, pbuf); } + if (result != ECA_NORMAL) { + fprintf(stderr, "Error from put operation: %s\n", ca_message(result)); + return 1; + } + result = ca_pend_io(caTimeout); if (result == ECA_TIMEOUT) { fprintf(stderr, "Write operation timed out: Data was not written.\n"); @@ -545,7 +550,7 @@ int main (int argc, char *argv[]) } if (result != ECA_NORMAL) { - fprintf(stderr, "Error occured writing data.\n"); + fprintf(stderr, "Error occured writing data: %s\n", ca_message(result)); return 1; } From 9020c2ce1a5da9bead4146335fabaf11b62eeb5e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Mar 2018 14:45:06 -0600 Subject: [PATCH 05/15] testdbConvert: Add some minor overflow checks --- src/ioc/db/test/testdbConvert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ioc/db/test/testdbConvert.c b/src/ioc/db/test/testdbConvert.c index cd0ed0ed2..cc175c0a0 100644 --- a/src/ioc/db/test/testdbConvert.c +++ b/src/ioc/db/test/testdbConvert.c @@ -38,7 +38,7 @@ static void testBasicGet(void) getter(&addr, scratch, 1, s_input_len, 0); - testOk1(scratch[0]==s_input[0]); + testOk1(scratch[0]==s_input[0] && scratch[1]==0); memset(scratch, 0x42, sizeof(s_input)); } @@ -128,7 +128,7 @@ static void testBasicPut(void) putter(&addr, s_input, 1, s_input_len, 0); - testOk1(scratch[0]==s_input[0]); + testOk1(scratch[0]==s_input[0] && scratch[1]==0); memset(scratch, 0x42, sizeof(s_input)); } From 958c81db89c1ad9726570f375ce66faf425e5398 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Mar 2018 17:25:42 -0600 Subject: [PATCH 06/15] Protect dbGetString() if field has overflowed Only return the number of characters that a string field can actually hold, in case it had a buffer overflow. --- src/ioc/dbStatic/dbStaticLib.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/ioc/dbStatic/dbStaticLib.c b/src/ioc/dbStatic/dbStaticLib.c index 6e9997ad1..963b452f1 100644 --- a/src/ioc/dbStatic/dbStaticLib.c +++ b/src/ioc/dbStatic/dbStaticLib.c @@ -51,8 +51,11 @@ static char *pNullString = ""; #define messagesize 276 #define RPCL_LEN INFIX_TO_POSTFIX_SIZE(80) -/* must be long enough to hold 32-bit signed integer in base 10 */ -STATIC_ASSERT(messagesize>=11); +/* Must be big enough to hold a 64-bit integer in base 10, but in + * the future when fields hold large JSON objects this fixed size + * allocation will probably have to become variable sized. + */ +STATIC_ASSERT(messagesize >= 21); static char *ppstring[5]={" NPP"," PP"," CA"," CP"," CPP"}; static char *msstring[4]={" NMS"," MS"," MSI"," MSS"}; @@ -208,11 +211,13 @@ static void zeroDbentry(DBENTRY *pdbentry) static char *getpMessage(DBENTRY *pdbentry) { char *msg = pdbentry->message; + if (!msg) { msg = dbCalloc(1, messagesize); pdbentry->message = msg; } - *msg = '\0'; + else + *msg = '\0'; return msg; } @@ -224,6 +229,17 @@ void dbMsgCpy(DBENTRY *pdbentry, const char *msg) pdbentry->message[messagesize-1] = '\0'; } +static +void dbMsgNCpy(DBENTRY *pdbentry, const char *msg, size_t len) +{ + getpMessage(pdbentry); + if (len >= messagesize) + len = messagesize-1; /* FIXME: Quietly truncates */ + + strncpy(pdbentry->message, msg, len); + pdbentry->message[len] = '\0'; +} + static void dbMsgPrint(DBENTRY *pdbentry, const char *fmt, ...) { @@ -1888,7 +1904,8 @@ char * dbGetString(DBENTRY *pdbentry) switch (pflddes->field_type) { case DBF_STRING: - dbMsgCpy(pdbentry, (char *)pfield); + /* Protect against a missing nil-terminator */ + dbMsgNCpy(pdbentry, (char *)pfield, pflddes->size); break; case DBF_CHAR: case DBF_UCHAR: From c05101bb3f8d9bf2ed984e85fde8bcb27402054a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Mar 2018 18:23:34 -0600 Subject: [PATCH 07/15] Make dbGetString() fetch link fields properly before iocInit --- src/ioc/dbStatic/dbStaticLib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ioc/dbStatic/dbStaticLib.c b/src/ioc/dbStatic/dbStaticLib.c index 963b452f1..69a4a6d1b 100644 --- a/src/ioc/dbStatic/dbStaticLib.c +++ b/src/ioc/dbStatic/dbStaticLib.c @@ -1928,6 +1928,8 @@ char * dbGetString(DBENTRY *pdbentry) case CONSTANT: if (plink->value.constantStr) { dbMsgCpy(pdbentry, plink->value.constantStr); + } else if (plink->text) { + dbMsgCpy(pdbentry, plink->text); } else { dbMsgCpy(pdbentry, ""); } @@ -2028,7 +2030,13 @@ char * dbGetString(DBENTRY *pdbentry) switch(plink->type) { case CONSTANT: - dbMsgCpy(pdbentry, "0"); + if (plink->value.constantStr) { + dbMsgCpy(pdbentry, plink->value.constantStr); + } else if (plink->text) { + dbMsgCpy(pdbentry, plink->text); + } else { + dbMsgCpy(pdbentry, ""); + } break; case MACRO_LINK: if (plink->value.macro_link.macroStr) { From d7e416e76a1c0d404c4dbd32b8333d3f6acfd627 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 7 Mar 2018 00:02:45 -0600 Subject: [PATCH 08/15] Now dbGetString() works before iocInit, fix asTest to match Previously dbGetString() of a link field would return an empty string until iocInit was run. I fixed that earlier today, so asTest started failing because it was checking for the old behavior. --- src/std/rec/test/asTestLib.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/std/rec/test/asTestLib.c b/src/std/rec/test/asTestLib.c index 18139233f..2043ed770 100644 --- a/src/std/rec/test/asTestLib.c +++ b/src/std/rec/test/asTestLib.c @@ -109,11 +109,7 @@ static void hookPass0(initHookState state) else testFail("Wrong link type: %d", (int)prec->out.type); - /* note that dbGetString() reads an empty string before links are initialized - * should probably be considered a bug, but has been the case for so long - * we call it a 'feature'. - */ - checkGetString(&entry, ""); + checkGetString(&entry, "rec0.DISV"); testOk1(dbPutString(&entry, "rec0.SEVR")==0); } else{ From 6cc623a7b40e255fa4b08918aec4d0a6a5fd4ca2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 10 Nov 2017 17:36:59 -0800 Subject: [PATCH 09/15] Fixed camonitor server side relative timestamps bug tsFirst needs to get initialized from the first server side timestamp instead of the client side tsNow. --- src/catools/tool_lib.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c index a29d7efaf..ce7a049a1 100644 --- a/src/catools/tool_lib.c +++ b/src/catools/tool_lib.c @@ -416,6 +416,12 @@ char *dbr2str (const void *value, unsigned type) ptsNewS = &((struct TYPE *)value)->stamp; \ ptsNewC = &tsNow; \ \ + if (!tsInitS) \ + { \ + tsFirst = *ptsNewS; \ + tsInitS = 1; \ + } \ + \ switch (tsType) { \ case relative: \ ptsRefC = &tsStart; \ @@ -508,12 +514,6 @@ void print_time_val_sts (pv* pv, unsigned long reqElems) epicsTimeGetCurrent(&tsNow); epicsTimeToStrftime(timeText, TIMETEXTLEN, timeFormatStr, &tsNow); - if (!tsInitS) - { - tsFirst = tsNow; - tsInitS = 1; - } - if (pv->nElems <= 1 && fieldSeparator == ' ') printf("%-30s", pv->name); else printf("%s", pv->name); printf("%c", fieldSeparator); From be8f35d78278ce51efa65b139ea7ff414bb1cbf8 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 9 Mar 2018 12:46:46 -0600 Subject: [PATCH 10/15] Fix for lp: #1754298 Cleaned up and reformatted since Dirk's original. --- src/ioc/dbStatic/dbStaticLib.c | 38 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/ioc/dbStatic/dbStaticLib.c b/src/ioc/dbStatic/dbStaticLib.c index 96868eded..a4ac17e20 100644 --- a/src/ioc/dbStatic/dbStaticLib.c +++ b/src/ioc/dbStatic/dbStaticLib.c @@ -1635,19 +1635,22 @@ int dbIsVisibleRecord(DBENTRY *pdbentry) long dbCreateAlias(DBENTRY *pdbentry, const char *alias) { - dbRecordType *precordType = pdbentry->precordType; - dbRecordNode *precnode = pdbentry->precnode; - dbRecordNode *pnewnode; - PVDENTRY *ppvd; - ELLLIST *preclist = NULL; + dbRecordType *precordType = pdbentry->precordType; + dbRecordNode *precnode = pdbentry->precnode; + dbRecordNode *pnewnode; + DBENTRY tempEntry; + PVDENTRY *ppvd; + + if (!precordType) + return S_dbLib_recordTypeNotFound; + if (!precnode) + return S_dbLib_recNotFound; + + dbInitEntry(pdbentry->pdbbase, &tempEntry); + if (!dbFindRecord(&tempEntry, alias)) + return S_dbLib_recExists; + dbFinishEntry(&tempEntry); - if (!precordType) return S_dbLib_recordTypeNotFound; - if (!precnode) return S_dbLib_recNotFound; - zeroDbentry(pdbentry); - if (!dbFindRecord(pdbentry, alias)) return S_dbLib_recExists; - zeroDbentry(pdbentry); - pdbentry->precordType = precordType; - preclist = &precordType->recList; pnewnode = dbCalloc(1, sizeof(dbRecordNode)); pnewnode->recordname = epicsStrDup(alias); pnewnode->precord = precnode->precord; @@ -1655,11 +1658,16 @@ long dbCreateAlias(DBENTRY *pdbentry, const char *alias) if (!(precnode->flags & DBRN_FLAGS_ISALIAS)) precnode->flags |= DBRN_FLAGS_HASALIAS; ellInit(&pnewnode->infoList); - ellAdd(preclist, &pnewnode->node); + + ellAdd(&precordType->recList, &pnewnode->node); precordType->no_aliases++; - pdbentry->precnode = pnewnode; + ppvd = dbPvdAdd(pdbentry->pdbbase, precordType, pnewnode); - if (!ppvd) {errMessage(-1,"Logic Err: Could not add to PVD");return(-1);} + if (!ppvd) { + errMessage(-1, "dbCreateAlias: Add to PVD failed"); + return -1; + } + return 0; } From 2307e94d1c5eefa40de318c40bad4365ef2110cf Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 12 Mar 2018 16:34:54 -0500 Subject: [PATCH 11/15] Rules for building bootable TESTPROD_RTEMS targets Previously if you wanted a .boot file it had to be installed. --- configure/RULES_BUILD | 11 ++++++++--- configure/os/CONFIG.Common.RTEMS | 7 +++++++ configure/os/CONFIG.Common.RTEMS-beatnik | 1 - configure/os/CONFIG.Common.RTEMS-mvme2100 | 1 - configure/os/CONFIG.Common.RTEMS-mvme2700 | 1 - configure/os/CONFIG.Common.RTEMS-mvme3100 | 1 - configure/os/CONFIG.Common.RTEMS-mvme5500 | 1 - configure/os/CONFIG.Common.RTEMS-pc386 | 1 - configure/os/CONFIG.Common.RTEMS-uC5282 | 1 - 9 files changed, 15 insertions(+), 10 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 1b7e5dc25..cec33eca7 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -102,6 +102,7 @@ endif # Products and Object libraries # PRODTARGETS += $(PRODNAME) $(MUNCHNAME) $(CTDT_SRCS) $(CTDT_OBJS) $(NMS) +TESTPRODTARGETS += $(TESTPRODNAME) $(TESTMUNCHNAME) #--------------------------------------------------------------- # Test specifications and test result files @@ -140,7 +141,7 @@ rebuild: clean install build: inc -build: $(OBJSNAME) $(LIBTARGETS) $(PRODTARGETS) $(TESTPRODNAME) \ +build: $(OBJSNAME) $(LIBTARGETS) $(PRODTARGETS) $(TESTPRODTARGETS) \ $(TARGETS) $(TESTSCRIPTS) $(INSTALL_LIB_INSTALLS) inc : $(COMMON_INC) $(INSTALL_INC) $(INSTALL_CONFIGS) @@ -158,13 +159,13 @@ clean: build_clean build_clean: $(ECHO) "Cleaning" - @$(RM) *.i *$(OBJ) *.a $(TESTPRODNAME) \ + @$(RM) *.i *$(OBJ) *.a \ $(LIBNAME) $(TESTLIBNAME) $(SHRLIBNAME) $(TESTSHRLIBNAME) \ $(DLLSTUB_LIBNAME) $(TESTDLLSTUB_LIBNAME) \ $(LOADABLE_SHRLIBNAME) \ $(INC) $(TARGETS) $(TDS) $(CLEANS) \ *.out MakefileInclude *.manifest *.exp \ - $(COMMON_INC) $(HDEPENDS_FILES) $(PRODTARGETS) \ + $(COMMON_INC) $(HDEPENDS_FILES) $(PRODTARGETS) $(TESTPRODTARGETS) \ $(TESTSCRIPTS) $(TAPFILES) $(JUNITFILES) ifdef RES @$(RM) *$(RES) @@ -322,6 +323,10 @@ $(MUNCHNAME): %$(MUNCH_SUFFIX): $(MUNCH_DEPENDS) %$(EXE) @$(RM) $@ $(MUNCH_CMD) +$(TESTMUNCHNAME): %$(MUNCH_SUFFIX): $(MUNCH_DEPENDS) %$(EXE) + @$(RM) $@ + $(MUNCH_CMD) + #--------------------------------------------------------------- # GeSys modules for RTEMS $(MODNAME): %$(MODEXT): %$(EXE) diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS index 9650ae255..c22e37a66 100644 --- a/configure/os/CONFIG.Common.RTEMS +++ b/configure/os/CONFIG.Common.RTEMS @@ -136,6 +136,13 @@ MOD_LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \ LINK.mod = $(CCC) -o $@ $(PRODDIR_LDFLAGS) $(MOD_LDFLAGS) LINK.mod += $(PROD_LDFLAGS) $(PROD_LD_OBJS) $(PROD_LD_RESS) $(MOD_LDLIBS) +#-------------------------------------------------- +# Here munching means creating a bootable object binary +ifdef MUNCH_SUFFIX + MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) + TESTMUNCHNAME = $(TESTPRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) +endif + #-------------------------------------------------- # RTEMS has neither shared libraries nor dynamic loading STATIC_BUILD=YES diff --git a/configure/os/CONFIG.Common.RTEMS-beatnik b/configure/os/CONFIG.Common.RTEMS-beatnik index 00080e7fd..aaf611638 100644 --- a/configure/os/CONFIG.Common.RTEMS-beatnik +++ b/configure/os/CONFIG.Common.RTEMS-beatnik @@ -15,7 +15,6 @@ ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120 OP_SYS_LDLIBS += -lbspExt MUNCH_SUFFIX = .boot -MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@ endef diff --git a/configure/os/CONFIG.Common.RTEMS-mvme2100 b/configure/os/CONFIG.Common.RTEMS-mvme2100 index 687af2374..0ae64c791 100644 --- a/configure/os/CONFIG.Common.RTEMS-mvme2100 +++ b/configure/os/CONFIG.Common.RTEMS-mvme2100 @@ -13,7 +13,6 @@ ARCH_DEP_CFLAGS += -DHAVE_PPCBUG OP_SYS_LDLIBS += -lbspExt MUNCH_SUFFIX = .boot -MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< rtems gzip -f9 rtems diff --git a/configure/os/CONFIG.Common.RTEMS-mvme2700 b/configure/os/CONFIG.Common.RTEMS-mvme2700 index f45e321c4..899fab17f 100644 --- a/configure/os/CONFIG.Common.RTEMS-mvme2700 +++ b/configure/os/CONFIG.Common.RTEMS-mvme2700 @@ -7,7 +7,6 @@ ARCH_DEP_CFLAGS += -DHAVE_PPCBUG ARCH_DEP_CFLAGS += -DNVRAM_INDIRECT MUNCH_SUFFIX = .boot -MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< rtems gzip -f9 rtems diff --git a/configure/os/CONFIG.Common.RTEMS-mvme3100 b/configure/os/CONFIG.Common.RTEMS-mvme3100 index cd9416ce7..e94d46211 100644 --- a/configure/os/CONFIG.Common.RTEMS-mvme3100 +++ b/configure/os/CONFIG.Common.RTEMS-mvme3100 @@ -15,7 +15,6 @@ ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120 OP_SYS_LDLIBS += -lbspExt MUNCH_SUFFIX = .boot -MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@ endef diff --git a/configure/os/CONFIG.Common.RTEMS-mvme5500 b/configure/os/CONFIG.Common.RTEMS-mvme5500 index 0c05b76a8..44ef7ea3e 100644 --- a/configure/os/CONFIG.Common.RTEMS-mvme5500 +++ b/configure/os/CONFIG.Common.RTEMS-mvme5500 @@ -16,7 +16,6 @@ ARCH_DEP_CFLAGS += -DBSP_NVRAM_BASE_ADDR=0xf1110000 OP_SYS_LDLIBS += -lbspExt MUNCH_SUFFIX = .boot -MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@ endef diff --git a/configure/os/CONFIG.Common.RTEMS-pc386 b/configure/os/CONFIG.Common.RTEMS-pc386 index b3150cc66..92ef4ac22 100644 --- a/configure/os/CONFIG.Common.RTEMS-pc386 +++ b/configure/os/CONFIG.Common.RTEMS-pc386 @@ -8,7 +8,6 @@ RTEMS_TARGET_CPU=i386 MUNCH_SUFFIX = .boot -MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< temp.bin $(BIN2BOOT) $@ 0x00097E00 \ diff --git a/configure/os/CONFIG.Common.RTEMS-uC5282 b/configure/os/CONFIG.Common.RTEMS-uC5282 index 9c6a58d33..6b0903e07 100644 --- a/configure/os/CONFIG.Common.RTEMS-uC5282 +++ b/configure/os/CONFIG.Common.RTEMS-uC5282 @@ -9,7 +9,6 @@ RTEMS_TARGET_CPU = m68k ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL MUNCH_SUFFIX = .boot -MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< $@ endef From 12bb8969adac77c1d9b899d43b4f940e2ac53b6f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 27 Nov 2017 18:43:41 -0800 Subject: [PATCH 12/15] Rework module dependency conflict error message for easier debugging. Now a simply grep for asyn in the build log will show you line by line which modules depend on which asyn versions. --- src/tools/convertRelease.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/convertRelease.pl b/src/tools/convertRelease.pl index 5900612f3..eab9395b3 100644 --- a/src/tools/convertRelease.pl +++ b/src/tools/convertRelease.pl @@ -231,10 +231,10 @@ sub checkRelease { AbsPath($macros{$parent}) ne AbsPath($ppath)) { print "\n" unless ($status); print "Definition of $parent conflicts with $app support.\n"; - print "In this application a RELEASE file defines\n"; - print "\t$parent = $macros{$parent}\n"; - print "but $app at $path defines\n"; - print "\t$parent = $ppath\n"; + print "In this application or module, a RELEASE file\n"; + print "conflicts with $app at $path\n"; + print " This application: $parent = $macros{$parent}\n"; + print " $app: $parent = $ppath\n"; $status = 1; } } From ceaff61c09cc45af511884a3e99804955682c692 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 14 Mar 2018 14:12:12 -0500 Subject: [PATCH 13/15] Pull in the podToHtml.pl script and rules from 3.15 This lets src/cap5 build with Perl installations that lack Perl's podchecker and pod2html scripts (e.g. Fedora 27). --- configure/RULES.Db | 14 +++++++++++++ configure/RULES_BUILD | 4 ++++ src/cap5/Makefile | 4 ---- src/tools/Makefile | 1 + src/tools/podToHtml.pl | 45 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/tools/podToHtml.pl diff --git a/configure/RULES.Db b/configure/RULES.Db index fcb7737f4..615fb2b5a 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -301,6 +301,20 @@ $(foreach file, $(DBD_INSTALLS), $(eval $(call DBD_INSTALLS_template, $(file)))) .PRECIOUS: $(COMMON_DBDS) $(COMMON_DIR)/%Include.dbd +##################################################### HTML files + +$(COMMON_DIR)/%.html: %.pm $(TOOLS)/podToHtml.pl + @$(RM) $(notdir $@) + $(PERL) $(TOOLS)/podToHtml.pl -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ + +$(COMMON_DIR)/%.html: ../%.pm $(TOOLS)/podToHtml.pl + @$(RM) $(notdir $@) + $(PERL) $(TOOLS)/podToHtml.pl -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ + +.PRECIOUS: $(COMMON_DIR)/%.html %.html + ##################################################### DB files $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 2c8de45c5..fb04b9e4c 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -500,6 +500,10 @@ $(INSTALL_HTML)/$(HTMLS_DIR)/%: ../% $(ECHO) "Installing html $@" @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) +$(INSTALL_HTML)/$(HTMLS_DIR)/%: $(COMMON_DIR)/% + $(ECHO) "Installing generated html $@" + @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL_TEMPLATES_SUBDIR)/%: ../% $(ECHO) "Installing $@" @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) diff --git a/src/cap5/Makefile b/src/cap5/Makefile index f749864c5..cde47ce8e 100644 --- a/src/cap5/Makefile +++ b/src/cap5/Makefile @@ -66,10 +66,6 @@ ifdef T_A $(RM) $@ $@_new $(PERL) $(XSUBPP) -typemap $(EXTUTILS)/typemap $< > $@_new && $(MV) $@_new $@ - %.html: ../%.pm - $(RM) $@ - podchecker $< && pod2html --infile=$< --outfile=$@ - $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH)/%: % $(ECHO) "Installing loadable shared library $@" @$(INSTALL_LIBRARY) -d -m $(LIB_PERMISSIONS) $< $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH) diff --git a/src/tools/Makefile b/src/tools/Makefile index 672944958..bcf12700d 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -28,6 +28,7 @@ PERL_SCRIPTS += makeMakefile.pl PERL_SCRIPTS += makeTestfile.pl PERL_SCRIPTS += mkmf.pl PERL_SCRIPTS += munch.pl +PERL_SCRIPTS += podToHtml.pl PERL_SCRIPTS += replaceVAR.pl PERL_SCRIPTS += tap-to-junit-xml.pl PERL_SCRIPTS += useManifestTool.pl diff --git a/src/tools/podToHtml.pl b/src/tools/podToHtml.pl new file mode 100644 index 000000000..99ee5b426 --- /dev/null +++ b/src/tools/podToHtml.pl @@ -0,0 +1,45 @@ +#!/usr/bin/env perl +#************************************************************************* +# Copyright (c) 2013 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +use strict; +use warnings; + +use Getopt::Std; +use Pod::Simple::HTML; + +our ($opt_o); + +$Getopt::Std::OUTPUT_HELP_VERSION = 1; +&HELP_MESSAGE if !getopts('o:') || @ARGV != 1; + +my $infile = shift @ARGV; + +if (!$opt_o) { + ($opt_o = $infile) =~ s/\. \w+ $/.html/x; + $opt_o =~ s/^.*\///; +} + +open my $out, '>', $opt_o or + die "Can't create $opt_o: $!\n"; + +my $podHtml = Pod::Simple::HTML->new(); + +$podHtml->html_css('style.css'); +$podHtml->perldoc_url_prefix(''); +$podHtml->perldoc_url_postfix('.html'); +$podHtml->set_source($infile); +$podHtml->output_string(\my $html); +$podHtml->run; + +print $out $html; +close $out; + +sub HELP_MESSAGE { + print STDERR "Usage: podToHtml.pl [-o file.html] file.pod\n"; + exit 2; +} From c8a7e1597ddf19301260bc8f2d42427fed0067cf Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 15 Mar 2018 10:57:55 -0500 Subject: [PATCH 14/15] VxWorks Timezone updates Remove 2017; fix hour in MET settings --- configure/CONFIG_SITE_ENV | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/configure/CONFIG_SITE_ENV b/configure/CONFIG_SITE_ENV index 1decb05c8..49331f9a4 100644 --- a/configure/CONFIG_SITE_ENV +++ b/configure/CONFIG_SITE_ENV @@ -34,35 +34,30 @@ # The future dates below assume the rules don't get changed; # see http://www.timeanddate.com/time/dst/2018.html to check. # -# DST for 2017 US: Mar 12 - Nov 05 -# EU: Mar 26 - Oct 29 -EPICS_TIMEZONE = CUS::360:031202:110502 -#EPICS_TIMEZONE = MET::-60:032602:102902 -# # DST for 2018 US: Mar 11 - Nov 04 # EU: Mar 25 - Oct 28 -#EPICS_TIMEZONE = CUS::360:031102:110402 -#EPICS_TIMEZONE = MET::-60:032502:102802 +EPICS_TIMEZONE = CUS::360:031102:110402 +#EPICS_TIMEZONE = MET::-60:032502:102803 # # DST for 2019 US: Mar 10 - Nov 03 # EU: Mar 31 - Oct 27 #EPICS_TIMEZONE = CUS::360:031002:110302 -#EPICS_TIMEZONE = MET::-60:033102:102702 +#EPICS_TIMEZONE = MET::-60:033102:102703 # # DST for 2020 US: Mar 08 - Nov 01 # EU: Mar 29 - Oct 25 #EPICS_TIMEZONE = CUS::360:030802:110102 -#EPICS_TIMEZONE = MET::-60:032902:102502 +#EPICS_TIMEZONE = MET::-60:032902:102503 # # DST for 2021 US: Mar 14 - Nov 07 # EU: Mar 28 - Oct 31 #EPICS_TIMEZONE = CUS::360:031402:110702 -#EPICS_TIMEZONE = MET::-60:032802:103102 +#EPICS_TIMEZONE = MET::-60:032802:103103 # # DST for 2022 US: Mar 13 - Nov 06 # EU: Mar 27 - Oct 30 #EPICS_TIMEZONE = CUS::360:031302:110602 -#EPICS_TIMEZONE = MET::-60:032702:103002 +#EPICS_TIMEZONE = MET::-60:032702:103003 # EPICS_TS_NTP_INET # NTP time server ip address for VxWorks and RTEMS. From 58dc1ced9b05bc19866a3ca49e0f8b4bd109faf0 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 15 Mar 2018 17:52:52 -0500 Subject: [PATCH 15/15] Fix softTest synchronization bug Local CA output links do *not* trigger processing in the same thread; need to wait for the dest record in Group 3, but not in Group 4. --- src/std/rec/test/softTest.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/std/rec/test/softTest.c b/src/std/rec/test/softTest.c index b29c955f9..e9cb319a0 100644 --- a/src/std/rec/test/softTest.c +++ b/src/std/rec/test/softTest.c @@ -12,6 +12,7 @@ #include "dbTest.h" #include "dbUnitTest.h" #include "epicsThread.h" +#include "epicsEvent.h" #include "errlog.h" #include "registryFunction.h" #include "subRecord.h" @@ -134,24 +135,25 @@ void testGroup2(void) int dest; +epicsEventId destEvent; static long destSubr(subRecord *prec) { dest = prec->val; prec->val = -1; + epicsEventMustTrigger(destEvent); return 0; } static -void checkOutput(const char *rec, int value) +void checkOutput3(const char *rec, int value) { testDiag("Checking record '%s'", rec); testdbPutFieldOk(rec, DBR_LONG, value); - /* Even with a local CA link, the dest record gets processed in - * the context of this thread (i.e. immediately). TPRO confirms. - */ + + epicsEventMustWait(destEvent); testOk(dest == value, "value %d output -> %d", value, dest); } @@ -170,22 +172,33 @@ void testGroup3(void) NULL, }; + destEvent = epicsEventMustCreate(epicsEventEmpty); + testDiag("============ Starting %s ============", EPICS_FUNCTION); for (rec = records; *rec; rec++) { - checkOutput(*rec, 1); + checkOutput3(*rec, 1); checkDtyp(*rec); } - checkOutput("do3.B0", 1); + checkOutput3("do3.B0", 1); checkDtyp("do3"); - checkOutput("do3c.B0", 1); + checkOutput3("do3c.B0", 1); checkDtyp("do3c"); for (rec = records; *rec; rec++) { - checkOutput(*rec, 0); + checkOutput3(*rec, 0); } - checkOutput("do3.B0", 0); - checkOutput("do3c.B0", 0); + checkOutput3("do3.B0", 0); + checkOutput3("do3c.B0", 0); +} + + +static +void checkOutput4(const char *rec, int value) +{ + testDiag("Checking record '%s'", rec); + + testdbPutFieldOk(rec, DBR_LONG, value); } /* Group 4 are all soft-channel output records with OUT being empty @@ -202,7 +215,7 @@ void testGroup4(void) testDiag("============ Starting %s ============", EPICS_FUNCTION); for (rec = records; *rec; rec++) { - checkOutput(*rec, 0); + checkOutput4(*rec, 0); } } @@ -211,7 +224,7 @@ void recTestIoc_registerRecordDeviceDriver(struct dbBase *); MAIN(softTest) { - testPlan(266); + testPlan(258); testdbPrepare(); testdbReadDatabase("recTestIoc.dbd", NULL, NULL);