Comments (2)
@Rossine The date and time are obviously wrong, but the repository you're asking the question is also wrong, -- alas, @vszakats has disabled the Issues tab on his repo, so the only way you can address him seems to be submitting a Pull Request.
from core.
It's an integer overflow issue, also fixed in 3.2 recently.
Here's my original patch for this, then the one re-synchronizing the type with 3.2 (it's possible they won't apply cleanly to the public 3.4 repo):
commit 28708992b58e06fa4d763f9f8bc8fc8fce6eac07
Author: Viktor Szakats
Date: 2022-06-13 23:19:23 +0000
HB_VERSION_REVISION: fix overflow for year 2022 and beyond
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 05c21be530..d141bbf87f 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -3,6 +3,17 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */
+2022-06-13 23:11 UTC Viktor Szakats
+ * include/hbapi.h
+ * src/common/hbver.c
+ * src/main/harbour.c
+ * src/pp/hbpp.c
+ * src/rtl/version.c
+ * src/vm/cmdarg.c
+ ! HB_VERSION_REVISION is storing the build date as a signed integer in
+ the form of YYMMDDHHMM. This has overflown with the year 2022. Fix
+ this by changing the internal type to HB_ULONG.
+
2022-06-13 16:37 UTC Viktor Szakats
* src/3rd/pcre2/Makefile
+ src/3rd/pcre2/pcre2_ucptables.c
diff --git a/include/hbapi.h b/include/hbapi.h
index 9cb99f10d8..a29f3da82c 100644
--- a/include/hbapi.h
+++ b/include/hbapi.h
@@ -1196,7 +1196,7 @@ extern HB_EXPORT void hb_verBuildInfo( void ); /* display Harbour,
extern HB_EXPORT void hb_verBuildInfoCB( PHB_OUT_FUNC ); /* pass Harbour, compiler and platform versions to callback function */
extern HB_EXPORT const char * hb_verCommitID( void ); /* retrieves a static buffer containing source repository hash/id */
extern HB_EXPORT const char * hb_verCommitIDShort( void ); /* retrieves a static buffer containing source repository hash/id (short version) */
-extern HB_EXPORT int hb_verCommitRev( void ); /* retrieves source repository revision number */
+extern HB_EXPORT HB_ULONG hb_verCommitRev( void ); /* retrieves source repository revision number */
extern HB_EXPORT const char * hb_verCommitInfo( void ); /* retrieves a static buffer containing source repository last commit header */
#if defined( HB_LEGACY_LEVEL4 )
extern HB_EXPORT char * hb_verBuildDate( void ); /* retrieves a newly allocated buffer containing build date and time */
diff --git a/src/common/hbver.c b/src/common/hbver.c
index 0793522361..e1ae32b5a1 100644
--- a/src/common/hbver.c
+++ b/src/common/hbver.c
@@ -1286,7 +1286,7 @@ char * hb_verHarbour( void )
HB_TRACE( HB_TR_DEBUG, ( "hb_verHarbour()" ) );
- hb_snprintf( szDateRaw, sizeof( szDateRaw ), "%d", hb_verCommitRev() );
+ hb_snprintf( szDateRaw, sizeof( szDateRaw ), "%lu", hb_verCommitRev() );
szDate[ 0 ] = '2';
szDate[ 1 ] = '0';
diff --git a/src/main/harbour.c b/src/main/harbour.c
index d7e41c62ac..6e57330eec 100644
--- a/src/main/harbour.c
+++ b/src/main/harbour.c
@@ -60,7 +60,7 @@ const char * hb_verCommitIDShort( void )
}
/* Source repository revision number */
-int hb_verCommitRev( void )
+HB_ULONG hb_verCommitRev( void )
{
return HB_VER_COMMIT_REV;
}
diff --git a/src/pp/hbpp.c b/src/pp/hbpp.c
index 561be94ee5..d2a8265c27 100644
--- a/src/pp/hbpp.c
+++ b/src/pp/hbpp.c
@@ -50,7 +50,7 @@
#define HB_DEFAULT_ORIGIN_URL_ "https://github.com/vszakats/hb/"
-int hb_verCommitRev( void )
+HB_ULONG hb_verCommitRev( void )
{
return 0;
}
@@ -332,7 +332,7 @@ static char * hb_pp_escapeString( char * szString )
static int hb_pp_generateVerInfo( char * szVerFile,
char * szCommitYear,
- int iCommitRev,
+ HB_ULONG nCommitRev,
char * szCommitInfo,
char * szCommitID,
char * szCommitIDShort,
@@ -391,7 +391,7 @@ static int hb_pp_generateVerInfo( char * szVerFile,
hb_xfree( pszEscaped );
}
- fprintf( fout, "#define HB_VER_COMMIT_REV %d\n", iCommitRev );
+ fprintf( fout, "#define HB_VER_COMMIT_REV %lu\n", nCommitRev );
if( szCommitInfo )
{
@@ -474,7 +474,7 @@ static char * hb_fsFileFind( const char * pszFileMask )
return NULL;
}
-static int hb_pp_TimeStampToNum( PHB_PP_STATE pState, char * pszLog, char * pszYear )
+static HB_ULONG hb_pp_TimeStampToNum( PHB_PP_STATE pState, char * pszLog, char * pszYear )
{
char szRevID[ 18 ];
int iLen;
@@ -538,12 +538,12 @@ static int hb_pp_TimeStampToNum( PHB_PP_STATE pState, char * pszLog, char * pszY
hb_pp_addDefine( pState, "HB_VER_SVNID", szRevID );
#endif
- return ( int ) hb_strValInt( szRevID, &iLen );
+ return ( HB_ULONG ) hb_strValInt( szRevID, &iLen );
}
static int hb_pp_parseChangelog( PHB_PP_STATE pState, const char * pszFileName,
int iQuiet, char ** pszCommitYear,
- int * piCommitRev, char ** pszCommitInfo )
+ HB_ULONG * pnCommitRev, char ** pszCommitInfo )
{
char * pszFree = NULL;
int iResult = 0;
@@ -666,7 +666,7 @@ static int hb_pp_parseChangelog( PHB_PP_STATE pState, const char * pszFileName,
hb_pp_addDefine( pState, "HB_VER_COMMIT_INFO", szLine );
*pszCommitInfo = hb_strdup( szLog );
- *piCommitRev = hb_pp_TimeStampToNum( pState, szLog, szCommitYear );
+ *pnCommitRev = hb_pp_TimeStampToNum( pState, szLog, szCommitYear );
*pszCommitYear = hb_strdup( szCommitYear );
}
@@ -684,7 +684,7 @@ static int hb_pp_parseRepoVer( PHB_PP_STATE pState, const char * pszFileName,
int iQuiet,
char ** pszCommitID, char ** pszCommitIDShort,
char ** pszCommitYear,
- int * piCommitRev, char ** pszCommitInfo,
+ HB_ULONG * pnCommitRev, char ** pszCommitInfo,
char ** pszURL )
{
FILE * file_in;
@@ -792,7 +792,7 @@ static int hb_pp_parseRepoVer( PHB_PP_STATE pState, const char * pszFileName,
*pszCommitInfo = hb_strdup( szCommitInfo );
- *piCommitRev = hb_pp_TimeStampToNum( pState, szCommitInfo, szCommitYear );
+ *pnCommitRev = hb_pp_TimeStampToNum( pState, szCommitInfo, szCommitYear );
*pszCommitYear = hb_strdup( szCommitYear );
}
@@ -828,7 +828,7 @@ int main( int argc, char * argv[] )
HB_BOOL fWrite = HB_FALSE, fChgLog = HB_FALSE, fRepoVer = HB_FALSE;
char * szCommitID = NULL, * szCommitIDShort = NULL;
char * szCommitYear = NULL, * szCommitInfo = NULL, * szURL = NULL;
- int iCommitRev = 0, iResult = 0, iQuiet = 0;
+ HB_ULONG nCommitRev = 0, iResult = 0, iQuiet = 0;
char * szPPRuleFuncName = NULL;
PHB_PP_STATE pState;
@@ -989,16 +989,16 @@ int main( int argc, char * argv[] )
if( fChgLog )
iResult = hb_pp_parseChangelog( pState, szLogFile, iQuiet,
- &szCommitYear, &iCommitRev, &szCommitInfo );
+ &szCommitYear, &nCommitRev, &szCommitInfo );
if( fRepoVer )
iResult = hb_pp_parseRepoVer( pState, szRepoVerFile, iQuiet,
- &szCommitID, &szCommitIDShort, &szCommitYear, &iCommitRev, &szCommitInfo, &szURL );
+ &szCommitID, &szCommitIDShort, &szCommitYear, &nCommitRev, &szCommitInfo, &szURL );
if( iResult == 0 )
iResult = hb_pp_preprocesfile( pState, szRuleFile, szPPRuleFuncName );
if( iResult == 0 && szVerFile && szRepoVerFile )
- iResult = hb_pp_generateVerInfo( szVerFile, szCommitYear, iCommitRev, szCommitInfo, szCommitID, szCommitIDShort, szURL );
+ iResult = hb_pp_generateVerInfo( szVerFile, szCommitYear, nCommitRev, szCommitInfo, szCommitID, szCommitIDShort, szURL );
if( iResult == 0 && hb_pp_errorCount( pState ) > 0 )
iResult = 1;
diff --git a/src/rtl/version.c b/src/rtl/version.c
index d3293cfac2..d4901e1f02 100644
--- a/src/rtl/version.c
+++ b/src/rtl/version.c
@@ -81,7 +81,7 @@ HB_FUNC( HB_VERSION )
case HB_VERSION_MINOR: hb_retni( HB_VER_MINOR ); break;
case HB_VERSION_RELEASE: hb_retni( HB_VER_RELEASE ); break;
case HB_VERSION_STATUS: hb_retc_const( HB_VER_STATUS ); break;
- case HB_VERSION_REVISION: hb_retni( hb_verCommitRev() ); break;
+ case HB_VERSION_REVISION: hb_retnint( hb_verCommitRev() ); break;
case HB_VERSION_COMMIT_INFO: hb_retc_const( hb_verCommitInfo() ); break;
case HB_VERSION_ID: hb_retc_const( hb_verCommitID() ); break;
case HB_VERSION_ID_SHORT: hb_retc_const( hb_verCommitIDShort() ); break;
diff --git a/src/vm/cmdarg.c b/src/vm/cmdarg.c
index a511786a1c..a53bcf45d7 100644
--- a/src/vm/cmdarg.c
+++ b/src/vm/cmdarg.c
@@ -891,7 +891,7 @@ const char * hb_verCommitIDShort( void )
}
/* Source repository revision number */
-int hb_verCommitRev( void )
+HB_ULONG hb_verCommitRev( void )
{
return HB_VER_COMMIT_REV;
}
commit e7f0d715525dcecb03d106af6dfa2827cb156ec6
Author: Viktor Szakats
Date: 2022-12-06 18:30:14 +0000
change return value of hb_verCommitRev() from HB_ULONG to HB_MAXINT
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 7a5e57caac..ae8036dd5d 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -3,11 +3,19 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */
+2022-12-06 18:28 UTC Viktor Szakats
+ * include/hbapi.h
+ * src/common/hbver.c
+ * src/main/harbour.c
+ * src/pp/hbpp.c
+ * src/vm/cmdarg.c
+ * change return value of hb_verCommitRev() from HB_ULONG to HB_MAXINT
+ to match Harbour 3.2
+
2022-11-25 18:14 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbapi.h
* src/vm/cmdarg.c
! changed returned type in hb_verSvnID() form int to HB_MAXINT
- ; [vsz]: Already fixed in 3.4 (with HB_ULONG)
* src/nortl/nortl.c
! fixed void* pointer incrementation
diff --git a/include/hbapi.h b/include/hbapi.h
index a29f3da82c..e22413a9c6 100644
--- a/include/hbapi.h
+++ b/include/hbapi.h
@@ -1196,7 +1196,7 @@ extern HB_EXPORT void hb_verBuildInfo( void ); /* display Harbour,
extern HB_EXPORT void hb_verBuildInfoCB( PHB_OUT_FUNC ); /* pass Harbour, compiler and platform versions to callback function */
extern HB_EXPORT const char * hb_verCommitID( void ); /* retrieves a static buffer containing source repository hash/id */
extern HB_EXPORT const char * hb_verCommitIDShort( void ); /* retrieves a static buffer containing source repository hash/id (short version) */
-extern HB_EXPORT HB_ULONG hb_verCommitRev( void ); /* retrieves source repository revision number */
+extern HB_EXPORT HB_MAXINT hb_verCommitRev( void ); /* retrieves source repository revision number */
extern HB_EXPORT const char * hb_verCommitInfo( void ); /* retrieves a static buffer containing source repository last commit header */
#if defined( HB_LEGACY_LEVEL4 )
extern HB_EXPORT char * hb_verBuildDate( void ); /* retrieves a newly allocated buffer containing build date and time */
diff --git a/src/common/hbver.c b/src/common/hbver.c
index 5448abe9ee..f73c5ed3e7 100644
--- a/src/common/hbver.c
+++ b/src/common/hbver.c
@@ -1286,7 +1286,7 @@ char * hb_verHarbour( void )
HB_TRACE( HB_TR_DEBUG, ( "hb_verHarbour()" ) );
- hb_snprintf( szDateRaw, sizeof( szDateRaw ), "%lu", hb_verCommitRev() );
+ hb_snprintf( szDateRaw, sizeof( szDateRaw ), "%" PFHL "u", hb_verCommitRev() );
szDate[ 0 ] = '2';
szDate[ 1 ] = '0';
diff --git a/src/main/harbour.c b/src/main/harbour.c
index 6e57330eec..2c4c76da8a 100644
--- a/src/main/harbour.c
+++ b/src/main/harbour.c
@@ -60,7 +60,7 @@ const char * hb_verCommitIDShort( void )
}
/* Source repository revision number */
-HB_ULONG hb_verCommitRev( void )
+HB_MAXINT hb_verCommitRev( void )
{
return HB_VER_COMMIT_REV;
}
diff --git a/src/pp/hbpp.c b/src/pp/hbpp.c
index d2a8265c27..6994cb8abc 100644
--- a/src/pp/hbpp.c
+++ b/src/pp/hbpp.c
@@ -50,7 +50,7 @@
#define HB_DEFAULT_ORIGIN_URL_ "https://github.com/vszakats/hb/"
-HB_ULONG hb_verCommitRev( void )
+HB_MAXINT hb_verCommitRev( void )
{
return 0;
}
@@ -332,7 +332,7 @@ static char * hb_pp_escapeString( char * szString )
static int hb_pp_generateVerInfo( char * szVerFile,
char * szCommitYear,
- HB_ULONG nCommitRev,
+ HB_MAXINT nCommitRev,
char * szCommitInfo,
char * szCommitID,
char * szCommitIDShort,
@@ -391,7 +391,7 @@ static int hb_pp_generateVerInfo( char * szVerFile,
hb_xfree( pszEscaped );
}
- fprintf( fout, "#define HB_VER_COMMIT_REV %lu\n", nCommitRev );
+ fprintf( fout, "#define HB_VER_COMMIT_REV %" PFHL "u\n", nCommitRev );
if( szCommitInfo )
{
@@ -474,7 +474,7 @@ static char * hb_fsFileFind( const char * pszFileMask )
return NULL;
}
-static HB_ULONG hb_pp_TimeStampToNum( PHB_PP_STATE pState, char * pszLog, char * pszYear )
+static HB_MAXINT hb_pp_TimeStampToNum( PHB_PP_STATE pState, char * pszLog, char * pszYear )
{
char szRevID[ 18 ];
int iLen;
@@ -538,12 +538,12 @@ static HB_ULONG hb_pp_TimeStampToNum( PHB_PP_STATE pState, char * pszLog, char *
hb_pp_addDefine( pState, "HB_VER_SVNID", szRevID );
#endif
- return ( HB_ULONG ) hb_strValInt( szRevID, &iLen );
+ return hb_strValInt( szRevID, &iLen );
}
static int hb_pp_parseChangelog( PHB_PP_STATE pState, const char * pszFileName,
int iQuiet, char ** pszCommitYear,
- HB_ULONG * pnCommitRev, char ** pszCommitInfo )
+ HB_MAXINT * pnCommitRev, char ** pszCommitInfo )
{
char * pszFree = NULL;
int iResult = 0;
@@ -684,7 +684,7 @@ static int hb_pp_parseRepoVer( PHB_PP_STATE pState, const char * pszFileName,
int iQuiet,
char ** pszCommitID, char ** pszCommitIDShort,
char ** pszCommitYear,
- HB_ULONG * pnCommitRev, char ** pszCommitInfo,
+ HB_MAXINT * pnCommitRev, char ** pszCommitInfo,
char ** pszURL )
{
FILE * file_in;
@@ -828,7 +828,7 @@ int main( int argc, char * argv[] )
HB_BOOL fWrite = HB_FALSE, fChgLog = HB_FALSE, fRepoVer = HB_FALSE;
char * szCommitID = NULL, * szCommitIDShort = NULL;
char * szCommitYear = NULL, * szCommitInfo = NULL, * szURL = NULL;
- HB_ULONG nCommitRev = 0, iResult = 0, iQuiet = 0;
+ HB_MAXINT nCommitRev = 0, iResult = 0, iQuiet = 0;
char * szPPRuleFuncName = NULL;
PHB_PP_STATE pState;
diff --git a/src/vm/cmdarg.c b/src/vm/cmdarg.c
index a53bcf45d7..ca719b2d83 100644
--- a/src/vm/cmdarg.c
+++ b/src/vm/cmdarg.c
@@ -891,7 +891,7 @@ const char * hb_verCommitIDShort( void )
}
/* Source repository revision number */
-HB_ULONG hb_verCommitRev( void )
+HB_MAXINT hb_verCommitRev( void )
{
return HB_VER_COMMIT_REV;
}
from core.
Related Issues (20)
- can't recompile harbour after msys2 clang64 openssl version upgrade HOT 5
- can't compile harbour anymore (msys2 clang64) HOT 1
- harbour instalation forgot contrib/hbhpdf/tests/files folder
- error adding symbols: Malformed archive HOT 5
- Static compilation - BASE/1302 Argument error: HOT 3
- TBROWSEDB() ERROR AFTER LAST HARBOUR UPDATE HOT 1
- HBMK2: unrecoverable error 6005: Exception error HOT 6
- GPF when accesing member of NIL using @ operator HOT 2
- memory and array HOT 9
- GTGLFW
- Official Docker image?
- OpenSSL HOT 3
- no error -w3 when use function
- harbour becomes UNUSABLE to me HOT 1
- Compare issue HOT 2
- Compiling Harbour under Debian 12 HOT 2
- RDDADS Problem HOT 6
- Have the Color extensions to the tools been tested? HOT 1
- Incorrect default value for lLock parameter in dbAppend() documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.