Hi,

I'm the package maintainer for Arch Linux and got this warning after the GCC 8.1 upgrade:

/home/gizdov/Packages/builds/xrootd/src/xrootd-4.8.3/src/XrdApps/XrdCpFile.cc: In constructor ‘XrdCpFile::XrdCpFile(const char*, int&)’:
/home/gizdov/Packages/builds/xrootd/src/xrootd-4.8.3/src/XrdApps/XrdCpFile.cc:91:20: error: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 8 bytes from a string of length 8 [-Werror=stringop-truncation]
             strncpy(ProtName, pTab[i].pHdr, sizeof(ProtName));
             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

which prevents the build. I could overwrite the -Werror flag, but I'd rather keep it as the dev intended. For the moment, I have patched the issue with the following:

diff -aur xrootd-4.8.3-old/src/XrdApps/XrdCpFile.cc xrootd-4.8.3-new/src/XrdApps/XrdCpFile.cc
--- xrootd-4.8.3-old/src/XrdApps/XrdCpFile.cc	2018-05-13 19:01:03.602433537 +0200
+++ xrootd-4.8.3-new/src/XrdApps/XrdCpFile.cc	2018-05-13 19:01:48.269454421 +0200
@@ -88,7 +88,7 @@
    for (i = 0; i < pTnum; i++)
        {if (!strncmp(FSpec, pTab[i].pHdr, pTab[i].pHsz))
            {Protocol = pTab[i].pVal;
-            strncpy(ProtName, pTab[i].pHdr, pTab[i].pHsz-3);
+            memcpy(ProtName, pTab[i].pHdr, pTab[i].pHsz-3);
             return;
            }
        }

Just wanted to make sure this is appropriate and then I can submit a pull request.

Thanks.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/xrootd/xrootd","title":"xrootd/xrootd","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/xrootd/xrootd"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Compilation warning blocking build with GCC 8.1 [-Werror=stringop-truncation] (#702)"}],"action":{"name":"View Issue","url":"https://github.com/xrootd/xrootd/issues/702"}}} {"@type":"MessageCard","@context":"http://schema.org/extensions","hideOriginalBody":"false","originator":"37567f93-e2a7-4e2a-ad37-a9160fc62647","title":"Compilation warning blocking build with GCC 8.1 [-Werror=stringop-truncation] (#702)","sections":[{"text":"","activityTitle":"**Konstantin Gizdov**","activityImage":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","activitySubtitle":"@kgizdov","facts":[{"name":"Repository: ","value":"xrootd/xrootd"},{"name":"Issue #: ","value":702}]}],"potentialAction":[{"name":"Add a comment","@type":"ActionCard","inputs":[{"isMultiLine":true,"@type":"TextInput","id":"IssueComment","isRequired":false}],"actions":[{"name":"Comment","@type":"HttpPOST","target":"https://api.github.com","body":"{\"commandName\":\"IssueComment\",\"repositoryFullName\":\"xrootd/xrootd\",\"issueId\":702,\"IssueComment\":\"{{IssueComment.value}}\"}"}]},{"name":"Close issue","@type":"HttpPOST","target":"https://api.github.com","body":"{\"commandName\":\"IssueClose\",\"repositoryFullName\":\"xrootd/xrootd\",\"issueId\":702}"},{"targets":[{"os":"default","uri":"https://github.com/xrootd/xrootd/issues/702"}],"@type":"OpenUri","name":"View on GitHub"},{"name":"Unsubscribe","@type":"HttpPOST","target":"https://api.github.com","body":"{\"commandName\":\"MuteNotification\",\"threadId\":334728479}"}],"themeColor":"26292E"}

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1