Opened 2 years ago

Closed 16 months ago

Last modified 16 months ago

#64021 closed defect (wontfix)

clamav @0.104.1_1 does not build on PPC Mac OS X 10.4.11, Tiger, because: 'O_SYMLINK' undeclared

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: tiger Cc: jonesc@…
Port: legacy-support

Description

[ 53%] Building C object libclamav/CMakeFiles/clamav.dir/others_common.c.o
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/build/libclamav && /opt/local/bin/gcc-apple-4.2 -DHAVE_CONFIG_H -DTHIS_IS_LIBCLAMAV -Dclamav_EXPORTS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/build/libclamav -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamunrar_iface -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/.. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/build -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclammspack/mspack -isystem /opt/local/include/libxml2 -isystem /opt/local/libexec/openssl3/include -isystem /opt/local/include -isystem /opt/local/include/json-c -pipe -Os -I/opt/local/include/LegacySupport -DNDEBUG -I/opt/local/include -I/opt/local/include/LegacySupport -O0 -arch ppc -mmacosx-version-min=10.4 -fPIC  -Wall -Wextra -Wformat-security -std=gnu89 -MD -MT libclamav/CMakeFiles/clamav.dir/others_common.c.o -MF CMakeFiles/clamav.dir/others_common.c.o.d -o CMakeFiles/clamav.dir/others_common.c.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c: In function 'cli_ftw':
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c:648: warning: missing initializer
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c:648: warning: (near initialization for 'entry.dirname')
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c: In function 'cli_realpath':
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c:1502: error: 'O_SYMLINK' undeclared (first use in this function)
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c:1502: error: (Each undeclared identifier is reported only once
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_sysutils_clamav/clamav/work/clamav-0.104.1/libclamav/others_common.c:1502: error: for each function it appears in.)

Attachments (3)

main.log (418.7 KB) - added by ballapete (Peter "Pete" Dyballa) 2 years ago.
Main.log from PPC Tiger
libclamav-others_common.c-O_SYMLINK@Tiger.patch (711 bytes) - added by ballapete (Peter "Pete" Dyballa) 2 years ago.
Patch for Tiger, fits into "platform darwin 8" clause
Portfile (4.9 KB) - added by ballapete (Peter "Pete" Dyballa) 2 years ago.
Portfile for clamav-legacy, already working

Download all attachments as: .zip

Change History (62)

Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger

comment:1 Changed 2 years ago by danielluke (Daniel J. Luke)

I don't have a 10.4.11 PPC machine to test on - so we'll need someone who does to work on a patch that I can review and apply to fix this.

comment:2 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

It's more a case for Legacy Support: Tiger does not have what Leopard and later have: /usr/include/sys/fcntl.h:#define O_SYMLINK 0x200000 /* allow open of a symlink */

comment:3 Changed 2 years ago by danielluke (Daniel J. Luke)

clamav already uses the legacysupport portgroup - or are you saying you want the legacysupport portgroup to fix this? (in which case, you probably want this opened against that portgroup and use clamav as an example?)

I don't want to try and guess what a good working solution would be since I don't have access to an appropriate machine to test on.

comment:4 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

This #define is just missing in recent legacy-support @1.0.4_0.

comment:5 Changed 2 years ago by danielluke (Daniel J. Luke)

I don't maintain the legacy-support potrgroup, though ;-)

comment:6 Changed 2 years ago by danielluke (Daniel J. Luke)

Cc: jonesc@… added

comment:7 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

So I have to open another bug report?

comment:8 Changed 2 years ago by danielluke (Daniel J. Luke)

I added the maintainer of the legacy-support port to this one - just figured you'd want to keep in in mind for the future.

comment:9 Changed 2 years ago by danielluke (Daniel J. Luke)

Cc: dluke@… removed
Port: legacy-support added; clamav removed

comment:10 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

The actual call in clamav-0.104.2/libclamav/others_common.c is:

fd = open(file_name, O_RDONLY | O_SYMLINK);

When O_SYMLINK is not defined and a file name is given, would it work to first check if the file is a symlink or a regular file and if yes open it read-only? The original code is:

 1460	cl_error_t cli_realpath(const char *file_name, char **real_filename)
 1461	{
 1462	    char *real_file_path = NULL;
 1463	    cl_error_t status    = CL_EARG;
 1464	#ifdef _WIN32
 1465	    HANDLE hFile = INVALID_HANDLE_VALUE;
 1466	#elif C_DARWIN
 1467	    int fd = -1;
 1468	#endif
 1469	
 1470	    cli_dbgmsg("Checking realpath of %s\n", file_name);
 1471	
 1472	    if (NULL == file_name || NULL == real_filename) {
 1473	        cli_warnmsg("cli_realpath: Invalid arguments.\n");
 1474	        goto done;
 1475	    }
 1476	
 1477	#ifdef _WIN32
 1478	
 1479	    hFile = CreateFileA(file_name,                  // file to open
 1480	                        GENERIC_READ,               // open for reading
 1481	                        FILE_SHARE_READ,            // share for reading
 1482	                        NULL,                       // default security
 1483	                        OPEN_EXISTING,              // existing file only
 1484	                        FILE_FLAG_BACKUP_SEMANTICS, // may be a directory
 1485	                        NULL);                      // no attr. template
 1486	    if (hFile == INVALID_HANDLE_VALUE) {
 1487	        cli_warnmsg("Can't open file %s: %d\n", file_name, GetLastError());
 1488	        status = CL_EOPEN;
 1489	        goto done;
 1490	    }
 1491	
 1492	    status = cli_get_filepath_from_handle(hFile, &real_file_path);
 1493	
 1494	#elif C_DARWIN
 1495	
 1496	    /* Using the filepath from filedesc method on macOS because
 1497	       realpath will fail to check the realpath of a symbolic link if
 1498	       the link doesn't point to anything.
 1499	       Plus, we probably don't wan tot follow the link in this case anyways,
 1500	       so this will check the realpath of the link, and not of the thing the
 1501	       link points to. */
 1502	    fd = open(file_name, O_RDONLY | O_SYMLINK);
 1503	    if (fd == -1) {
 1504	        char err[128];
 1505	        cli_strerror(errno, err, sizeof(err));
 1506	        if (errno == EACCES) {
 1507	            status = CL_EACCES;
 1508	        } else {
 1509	            status = CL_EOPEN;
 1510	        }
 1511	        cli_dbgmsg("Can't open file %s: %s\n", file_name, err);
 1512	        goto done;
 1513	    }
 1514	
 1515	    status = cli_get_filepath_from_filedesc(fd, &real_file_path);
 1516	
 1517	#else
 1518	
 1519	    real_file_path = realpath(file_name, NULL);
 1520	    if (NULL == real_file_path) {
 1521	        status = CL_EMEM;
 1522	        goto done;
 1523	    }
 1524	
 1525	    status = CL_SUCCESS;
 1526	
 1527	#endif
 1528	
 1529	    *real_filename = real_file_path;
 1530	
 1531	done:
 1532	
 1533	#ifdef _WIN32
 1534	    if (hFile != INVALID_HANDLE_VALUE) {
 1535	        CloseHandle(hFile);
 1536	    }
 1537	#elif C_DARWIN
 1538	    if (fd != -1) {
 1539	        close(fd);
 1540	    }
 1541	#endif
 1542	
 1543	    return status;
 1544	}

which could be turned into:

#if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050)
          if(S_ISLNK(file_name) | S_ISREG(file_name)) {
	    fd = open(file_name, O_RDONLY);
          }
#else
 1502	    fd = open(file_name, O_RDONLY | O_SYMLINK);
#endif  /* Tiger workaround for missing O_SYMLINK macro */

Could it? And would this work? (I am not really a C programmer.)

Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Patch for Tiger, fits into "platform darwin 8" clause

comment:11 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

It seems to work with this patch!

comment:12 Changed 2 years ago by danielluke (Daniel J. Luke)

Can you submit this patch upstream to the clamav folks and add a link here to your submission there, please?

comment:13 in reply to:  12 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to danielluke: No. The whole last week I kept asking for a bugzilla account (https://bugzilla.clamav.net/createaccount.cgi) to report the bug and never received an eMail with an invitation.

comment:14 Changed 2 years ago by danielluke (Daniel J. Luke)

You probably didn't get email because switched to github - https://docs.clamav.net/manual/Usage/ReportABug.html

comment:15 in reply to:  14 ; Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

comment:16 Changed 2 years ago by kencu (Ken)

clamav only works on Tiger now because of the gross hack I wrote up and that sits in the Portfile:

https://github.com/macports/macports-ports/blob/6c46539d02f1a891a94ebf2e9849e0f85ba1a466/sysutils/clamav/Portfile#L47

so it would be one overwhelming tremendous stretch if they incorporated some kind of patch for Tiger that could never work in their build anyway...

comment:17 Changed 2 years ago by kencu (Ken)

but you can always ask :>

comment:18 in reply to:  15 ; Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Done: https://github.com/Cisco-Talos/clamav/issues/435.

The case has been closed because Tiger is out of service.

comment:19 Changed 2 years ago by kencu (Ken)

Peter, my suggestion to you would be to make a new port, perhaps clamav-legacy or whatever you want to call it.

Then you can put that in macports, and update it yourself to newer versions after you have confirmed they build and work.

You might lag a bit behind clamav which needs little fixing to build on newer systems, but on the other hand you'd have something that you can control and update when you want.

And then Daniel need never think of these legacy systems again, and you have a working clamav that people on older systems can use if they so choose.

There are many similar examples in MacPorts of such things being done, so the road is clear and plowed, if you want to take the reins on that.

After all, you seem to be the one paying 99.99% of the attention to clamav on older systems anyway!

comment:20 in reply to:  19 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

Peter, my suggestion to you would be to make a new port, perhaps clamav-legacy or whatever you want to call it.

Like these?

-rw-r--r-- 1 root x11 1808 17. Nov 2020  devel/libusb-legacy/Portfile
-rw-r--r-- 1 root x11 1213 17. Nov 2020  textproc/pdfgrep-legacy/Portfile
-rw-r--r-- 1 root x11 4672 28. Apr 2021  x11/xorg-server-legacy/Portfile

This might be useful. One problem is that I do not understand the "programmming language" (really?) of Portfiles…

comment:21 Changed 2 years ago by kencu (Ken)

(smiling) after 6 years of tickets, perhaps it’s time you spent an hour?

comment:22 in reply to:  18 Changed 2 years ago by danielluke (Daniel J. Luke)

Replying to ballapete:

The case has been closed because Tiger is out of service.

I saw. It's not unreasonable from their side, but I was hoping they'd include it.

I can look over the patch and include it in the regular clamav port - but I won't spend a lot of time forward-porting the patch for newer clamav releases if they need it (ie, future updates may break 10.4 again). It's quickest to review and apply a PR, so if you're keeping it working on 10.4 and it breaks - that's probably the best way to go.

If you want to have control over when the port updates and keep it on a version that builds for 10.4 at all times, then a -legacy port makes sense.

comment:23 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

I am already following Ken, subscribed to clamav-announce and found that these two lines would fit into Portfile:

compiler.cxx_standard   2014
configure.cxxflags-append   -std=c++14

configure seems to check for modern compilers. Clang certainly has this standard. And with these two lines port will certainly automatically select GCC7 on old systems. (GCC 4.2 cannot compile.)

To introduce clamav-legacy (Tiger…Lion, Mac OS X 10.4…10.7, os.major 8…11) it's probably best to open a new case, right? clamavs "old system support" (if { ${os.platform} eq "darwin" && ${os.major} < 11 }) does not include Lion – should I adjust that?

comment:24 Changed 2 years ago by kencu (Ken)

copy the last clamav port that worked, rename it clamav-legacy, tweak things so it works properly as clamav-legacy (you'll see what needs to be done quickly enough), and you're on your way!

comment:25 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

It's not that easy. The +tests variant needs some Python version plus check plus a Python module pytest. It seems that port cannot install this variant's dependencies. I am not sure whether the documentation explains (or provides the code block) how to handle the many "active" Python versions and set a default version…

comment:26 Changed 2 years ago by kencu (Ken)

sounds like it doesn’t work in the existing port either then???

comment:27 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

It works, but only for one Python version and it certainly does not install this, check and pytest for variant "tests". When I first invoke port -vdsk build clamav-legacy +tests and then port -vdsk test clamav-legacy +tests the package is rebuilt.

comment:28 Changed 2 years ago by danielluke (Daniel J. Luke)

The tests stuff is weird. check and pytest are only needed to actually run the tests, so they are 'depends_test' and only get installed if you do port test clamav. You need to configure differently for the tests to work, so they're in the +test variant that does the configure changes necessary. The upstream build will fail if you don't have check/pytest installed and configure for tests. Additionally, after all of that if you do port test clamav +tests it will run the tests against whatever the installed version of clamav's libraries are, and not the ones in the new build.

Which is a long way of saying, that they don't work well and I haven't made them better (though they work well enough that I can run the tests before committing a new portfile) - if you end up fixing them for the -legacy port, then I'd happily incorporate those changes into the clamav port, though.

comment:29 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

I moved "development" from my old and slow PowerBook to a MacBook Pro – this should produce the same results, just not apply the Tiger patch. No version of pytest gets installed. I am attaching my recent version of clamav-legacy Portfile – it resides in a local tree, is indexed and visible.

Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: Portfile added

Portfile for clamav-legacy, already working

comment:30 Changed 2 years ago by kencu (Ken)

getting there!

If you change this:

depends_build

to this:

depends_build-append

then you no longer overwrite the deps set by the cmake PortGroup, and you no longer need to manually add the dep on cmake. So do that.

The depend_N should also be depend_N-append for the same reason.

I suggest you take the opportunity to cut a bunch of fat out, like get rid of all the python variants, just pick one python for the tests and require it, 99% less confusion immediately.

And maybe get rid of the "milter" variant, as it probably is of no interest to legacy users anyway, if it even builds and works at all -- or if it does build and work, just enable it all the time. Less variants, less confusion, less errors, less build failures, less tickets, more happiness.

And as you are supporting only < darwin11 with this port, just apply the patchfiles all the time and put a blocker in so that anyone on >= darwin11 is forced to the real clamav port.

Last edited 2 years ago by kencu (Ken) (previous) (diff)

comment:31 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

The Portfile I uploaded has these depends statements:

depends_build           path:bin/cmake:cmake \
depends_lib             port:curl \
    depends_test-append          port:check
        depends_test-append     port:python37 \
        depends_test-append     port:python38 \
        depends_test-append     port:python39 \
        depends_test-append     port:python310 \

When I change them to become

depends_build-append    path:bin/cmake:cmake \
depends_lib-append      port:curl \
        depends_lib-append      port:libmilter
    depends_test-append          port:check
        depends_test-append     port:python37 \
        depends_test-append     port:python38 \
        depends_test-append     port:python39 \
        depends_test-append     port:python310 \

port -vdk build clamav-legacy +tests leads to:

-- Found Git: /opt/local/bin/git (found version "2.35.1") 
CMake Error at /opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Libcheck (missing: LIBCHECK_INCLUDE_DIR LIBCHECK_LIBRARY)
Call Stack (most recent call first):
  /opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibcheck.cmake:89 (find_package_handle_standard_args)
  CMakeLists.txt:194 (find_package)

I don't think that my Python use cases contribute a problem because I have set in /opt/local/etc/macports/variants.conf +python38 – I just do not want to juggle with half a dozen different Python versions, which also sets a default version (hopefully):

pete 248 /\  port variants clamav-legacy
clamav-legacy has the variants:
   clamav_milter: Build with libmilter support
   debug: Enable debug binaries
   tests: Enable running 'port test'
pete 249 /\  port variants clamav-legacy +tests
Tests run using the installed version of this port.
clamav-legacy has the variants:
   clamav_milter: Build with libmilter support
   debug: Enable debug binaries
   python310: Create test data with Python 3.10 and run tests with Python 3.10
     * conflicts with python37 python38 python39
   python37: Create test data with Python 3.7 and run tests with Python 3.7
     * conflicts with python310 python38 python39
(+)python38: Create test data with Python 3.8 and run tests with Python 3.8
     * conflicts with python310 python37 python39
   python39: Create test data with Python 3.9 and run tests with Python 3.9
     * conflicts with python310 python37 python38
  +tests: Enable running 'port test'

comment:32 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

It does not help to change depends_test-append port:check to depends-append port:checkport simply does not append and install or activate anything for tests.

comment:33 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

ClamAV complains when pytest is not found, but it then uses the unit tests from CMake, i.e. the ctest programme. The results in GNU Emacs' *compilation* buffer are the same.

comment:34 in reply to:  28 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to danielluke:

The tests stuff is weird. […] Additionally, after all of that if you do port test clamav +tests it will run the tests against whatever the installed version of clamav's libraries are, and not the ones in the new build.

Indeed! When I deactivate clamav I get:

-*- mode: compilation; default-directory: "/opt/local/var/macports/build/_opt_local_ports_sysutils_clamav-legacy/clamav-legacy/work/build/" -*-
Compilation started at Tue Feb  1 18:45:44

time nice gmake -k test V=1
[36mRunning tests...[0m
/opt/local/bin/ctest --force-new-ctest-process 
Test project /opt/local/var/macports/build/_opt_local_ports_sysutils_clamav-legacy/clamav-legacy/work/build
    Start 1: libclamav
1/5 Test #1: libclamav ........................***Failed    8.88 sec
    Start 2: clamscan
2/5 Test #2: clamscan .........................***Failed    3.44 sec
    Start 3: clamd
3/5 Test #3: clamd ............................***Failed   10.06 sec
    Start 4: freshclam
4/5 Test #4: freshclam ........................   Passed   36.50 sec
    Start 5: sigtool
5/5 Test #5: sigtool ..........................   Passed    0.54 sec

40% tests passed, 3 tests failed out of 5

Total Test time (real) =  59.43 sec

The following tests FAILED:
	  1 - libclamav (Failed)
	  2 - clamscan (Failed)
	  3 - clamd (Failed)
Errors while running CTest
Output from these tests are in: /opt/local/var/macports/build/_opt_local_ports_sysutils_clamav-legacy/clamav-legacy/work/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
gmake: *** [Makefile:94: test] Fehler 8
12.080u 6.403s 0:59.49 31.0%	0+0k 0+0io 7pf+0w

Compilation exited abnormally with code 2 at Tue Feb  1 18:46:43

So the tests are run using the old already installed programmes. The new versions can be found in the directories $(port work clamav-legacy)/build/{clamd,clamscan,freshclam,sigtool}:

411193308        0 drwxr-xr-x    6 macports wheel      192  1 Feb 18:27 …/clamav-legacy/work/build/sigtool
411196035      416 -rwxr-xr-x    1 macports wheel   212472  1 Feb 18:27 …/clamav-legacy/work/build/sigtool/sigtool
411193306        0 drwxr-xr-x    6 macports wheel      192  1 Feb 18:26 …/clamav-legacy/work/build/clamscan
411195933      352 -rwxr-xr-x    1 macports wheel   176616  1 Feb 18:26 …/clamav-legacy/work/build/clamscan/clamscan
411193302        0 drwxr-xr-x    6 macports wheel      192  1 Feb 18:26 …/clamav-legacy/work/build/clamd
411195905      392 -rwxr-xr-x    1 macports wheel   198232  1 Feb 18:26 …/clamav-legacy/work/build/clamd/clamd
411193314        0 drwxr-xr-x    6 macports wheel      192  1 Feb 18:27 …/clamav-legacy/work/build/freshclam
411196050      176 -rwxr-xr-x    1 macports wheel    88296  1 Feb 18:27 …/clamav-legacy/work/build/freshclam/freshclam
411193292        0 drwxr-xr-x    9 macports wheel      288  1 Feb 18:26 …/clamav-legacy/work/build/libclamav/libclamav.9.1.0.dylib

Wouldn't setting PATH allow to perform a real test?

comment:35 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

On the command line

root 311 /\ env PATH=`port work clamav-legacy`/build/clamd:`port work clamav-legacy`/build/clamscan:`port work clamav-legacy`/build/freshclam:`port work clamav-legacy`/build/sigtool:$PATH which sigtool clamscan clamd freshclam
/opt/local/var/macports/build/_opt_local_ports_sysutils_clamav-legacy/clamav-legacy/work/build/sigtool/sigtool
/opt/local/var/macports/build/_opt_local_ports_sysutils_clamav-legacy/clamav-legacy/work/build/clamscan/clamscan
/opt/local/var/macports/build/_opt_local_ports_sysutils_clamav-legacy/clamav-legacy/work/build/clamd/clamd
/opt/local/var/macports/build/_opt_local_ports_sysutils_clamav-legacy/clamav-legacy/work/build/freshclam/freshclam
root 312 /\ env PATH=`port work clamav-legacy`/build/clamd:`port work clamav-legacy`/build/clamscan:`port work clamav-legacy`/build/freshclam:`port work clamav-legacy`/build/sigtool:$PATH freshclam --help

                      Clam AntiVirus: Database Updater 0.104.2
           By The ClamAV Team: https://www.clamav.net/about.html#credits
           (C) 2022 Cisco Systems, Inc.

    freshclam [options]

    --help               -h              Show this help
    --version            -V              Print version number and exit
    --verbose            -v              Be verbose
    --debug                              Enable debug messages
    --quiet                              Only output error messages
    --no-warnings                        Don't print and log warnings
    --stdout                             Write to stdout instead of stderr. Does not affect 'debug' messages.
    --show-progress                      Show download progress percentage

    --config-file=FILE                   Read configuration from FILE.
    --log=FILE           -l FILE         Log into FILE
    --daemon             -d              Run in daemon mode
    --pid=FILE           -p FILE         Save daemon's pid in FILE
    --foreground         -F              Don't fork into background (for use in daemon mode).
    --user=USER          -u USER         Run as USER
    --no-dns                             Force old non-DNS verification method
    --checks=#n          -c #n           Number of checks per day, 1 <= n <= 50
    --datadir=DIRECTORY                  Download new databases into DIRECTORY
    --daemon-notify[=/path/clamd.conf]   Send RELOAD command to clamd
    --local-address=IP   -a IP           Bind to IP for HTTP downloads
    --on-update-execute=COMMAND          Execute COMMAND after successful update.
                                         Use EXIT_1 to return 1 after successful database update.
    --on-error-execute=COMMAND           Execute COMMAND if errors occurred
    --on-outdated-execute=COMMAND        Execute COMMAND when software is outdated
    --update-db=DBNAME                   Only update database DBNAME

root 313 /\ env PATH=`port work clamav-legacy`/build/clamd:`port work clamav-legacy`/build/clamscan:`port work clamav-legacy`/build/freshclam:`port work clamav-legacy`/build/sigtool:$PATH freshclam -vd
Current working dir is /usr/local/clamXav/share/clamav/
Loaded freshclam.dat:
  version:    1
  uuid:       f0fccc01-fe3a-487e-baa4-a19e9b62d7f5
root 314 /\ env PATH=`port work clamav-legacy`/build/clamd:`port work clamav-legacy`/build/clamscan:`port work clamav-legacy`/build/freshclam:`port work clamav-legacy`/build/sigtool:$PATH freshclam -v
Current working dir is /usr/local/clamXav/share/clamav/
Loaded freshclam.dat:
  version:    1
  uuid:       f0fccc01-fe3a-487e-baa4-a19e9b62d7f5
ClamAV update process started at Tue Feb  1 19:01:40 2022
Current working dir is /usr/local/clamXav/share/clamav/
Querying current.cvd.clamav.net
TTL: 1616
fc_dns_query_update_info: Software version from DNS: 0.103.5
Current working dir is /usr/local/clamXav/share/clamav/
check_for_new_database_version: Local copy of daily found: daily.cld.
query_remote_database_version: daily.cvd version from DNS: 26440
daily.cld database is up-to-date (version: 26440, sigs: 1973273, f-level: 90, builder: raynman)
fc_update_database: daily.cld already up-to-date.
Current working dir is /usr/local/clamXav/share/clamav/
check_for_new_database_version: Local copy of main found: main.cld.
query_remote_database_version: main.cvd version from DNS: 62
main.cld database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
fc_update_database: main.cld already up-to-date.
Current working dir is /usr/local/clamXav/share/clamav/
check_for_new_database_version: Local copy of bytecode found: bytecode.cld.
query_remote_database_version: bytecode.cvd version from DNS: 333
bytecode.cld database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
fc_update_database: bytecode.cld already up-to-date.

works, but invoking

env PATH=`port work clamav-legacy`/build/clamd:`port work clamav-legacy`/build/clamscan:`port work clamav-legacy`/build/freshclam:`port work clamav-legacy`/build/sigtool:$PATH gmake -k test

(I live in tcsh) fails. At least the log files in $(port work clamav-legacy)/build/Testing/Temporary show that LD_LIBRARY_PATH might set correctly for the tests.

comment:36 in reply to:  32 ; Changed 2 years ago by kencu (Ken)

Replying to ballapete:

It does not help to change depends_test-append port:check to depends-append port:checkport simply does not append and install or activate anything for tests.

that suggestion was referring to the cmake dep.

comment:37 Changed 2 years ago by kencu (Ken)

IMHO -- please be careful not to sink your otherwise beautifully simple clamav-legacy port with a whole huge morass of potentially unsolvable testing mess that you don't really need to resolve right now anyway :>.

very very simple testing setup, like the clamav port has now, don't change a single thing, or remove the testing and run the tests yourself manually before you update it.

But you can quickly get yourself into such a HORRIBLE MESS of overengineering here that nothing ever makes any progress.

comment:38 in reply to:  36 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

that suggestion was referring to the cmake dep.

You probably mean check and I reported the result of

    depends-append              port:check

comment:39 in reply to:  37 ; Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

IMHO -- please be careful not to sink your otherwise beautifully simple clamav-legacy port with a whole huge morass of potentially unsolvable testing mess that you don't really need to resolve right now anyway :>.

Right! After sleep I'll forward the problem to the developers of clamav. (And I hope they accept Monterey 12.1, because 12.2 is already out!)

very very simple testing setup, like the clamav port has now, don't change a single thing, or remove the testing and run the tests yourself manually before you update it.

The latter is what I think is the best in the recent situation.

But you can quickly get yourself into such a HORRIBLE MESS of overengineering here that nothing ever makes any progress.

Maybe I'll have to dive into it, when the developers will tell me more…

Besides, port also needs two updates: 1.) install that what a variant needs for its job, and 2.) learn to port select --set pytest pytest38 or such at the end! Or nothing will change although it's installed.

comment:40 Changed 2 years ago by kencu (Ken)

I meant change this:

depends_build path:bin/cmake:cmake \
              port:pkgconfig \
              bin:git:git

to this:

depends_build-append \
              port:pkgconfig \
              bin:git:git

comment:41 in reply to:  40 ; Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

Ken, this change makes no difference. Besides, cmake is needed for building ClamAV. What's not really needed is bin:git:git. And livecheck can certainly put inside the tests variant. For ClamAV it might be obsolete in case clamav-announce, my eMail provider and Apple's Mail work correctly (and do not make it disappear).

comment:42 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

comment:43 in reply to:  41 ; Changed 2 years ago by kencu (Ken)

Replying to ballapete:

Replying to kencu:

Ken, this change makes no difference.

True, but It is incorrect to overwrite the cmake PortGroup's setting of depends_build like that, Pete.

As soon as you PR it, Ryan or anyone will be all over it. Just trying to keep things smooth for you!

Last edited 2 years ago by kencu (Ken) (previous) (diff)

comment:44 Changed 2 years ago by kencu (Ken)

I don't know if git is needed for the build.

If you conclude it is not needed to build your clamav-legacy port, then by all means, get rid of it.

You are the boss of that, once you become maintainer.

But do make sure, because presumably someone put it there for some reason.

comment:45 in reply to:  43 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

True, but It is incorrect to overwrite the cmake PortGroup's setting of depends_build like that, Pete.

I see! I was already guessing whether PortGroup cmake 1.1 could be sufficient.

comment:46 in reply to:  44 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

I don't know if git is needed for the build.

If you conclude it is not needed to build your clamav-legacy port, then by all means, get rid of it.

CMake checks for git, but it is obviously not used to build ClamAV. I am going to study some documentation inside the source package anyway. libcurl is shared by many binaries.

comment:47 Changed 2 years ago by kencu (Ken)

by the way, your test failures are due, I think, to the way MacPorts builds stuff with cmake.

specifically, this option has to be reverted to off:

https://github.com/macports/macports-ports/blob/fdc80cd761af072aa4ec52f0a5082f8c0c5135de/_resources/port1.0/group/cmake-1.1.tcl#L105

there are a number of examples in the ports tree where I fixed this so tests would work properly. I’m sure you’ll find one easily that shows how to fix it.

I doubt it’s an upstream issue at all, it’s MacPort’s issue.

comment:48 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

For the tests variant only Portfile has:

    configure.pre_args-replace  -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                                -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

This is in my opinion correct. Or is deleting these two lines, i.e. using the default, correct?

comment:49 in reply to:  39 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to ballapete:

Besides, port also needs two updates: 1.) install that what a variant needs for its job, and 2.) learn to port select --set pytest pytest38 or such at the end! Or nothing will change although it's installed.

Using

depends_build-append        port:check
depends_lib-append          port:git

inside the tests variant makes port wanting to install them when they're not there:

pete 276 /\ port deps clamav-legacy
Full Name: clamav-legacy @0.104.2_1
Build Dependencies:   pkgconfig
Library Dependencies: openssl3, zlib, bzip2, libxml2, pcre2, libiconv, json-c, ncurses, curl, libtool
pete 277 /\ port deps clamav-legacy +tests
Tests run using the installed version of this port.
Full Name: clamav-legacy @0.104.2_1+tests
Build Dependencies:   pkgconfig, check
Library Dependencies: openssl3, zlib, bzip2, libxml2, pcre2, libiconv, json-c, ncurses, curl, libtool, git

comment:50 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

The documentation in clamav-0.104.2/docs/html/manual/Installing/Installing-from-source-Unix.html has:

Tip: Setting ENABLE_JSON_SHARED=OFF is preferred, but it will require json-c version 0.15 or newer unless you build json-c yourself with custom options. If json-c 0.15+ is not available to you, you may omit the option and just use the json-c shared library. But be warned that downstream applications which use libclamav.so may crash if they also use a different JSON library.

I am encountering on Big Sur and Monterey crashes of ClamAV. In FeedbackAgent I cannot find any traces, and the files were already deleted. And Time Machine, of course, does not save the crash logs, so it's just an assumption, until the next crash, that I might have this problem due to default ENABLE_JSON_SHARED=ON. json-c is now @0.15-20200726_0, which is obviously sufficient.

comment:51 in reply to:  47 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

by the way, your test failures are due, I think, to the way MacPorts builds stuff with cmake.

specifically, this option has to be reverted to off:

https://github.com/macports/macports-ports/blob/fdc80cd761af072aa4ec52f0a5082f8c0c5135de/_resources/port1.0/group/cmake-1.1.tcl#L105

Could be ClamAV's clamav-0.104.2/CMakeLists.txt produces the tests failures itself:

  158	#
  159	# Set RPATH for custom install prefixes
  160	#
  161	if(APPLE)
  162	    set(CMAKE_MACOSX_RPATH 1)
  163	endif()

IMO this possibly resets the configure.pre_args-replace statement in Portfile.

comment:52 Changed 2 years ago by kencu (Ken)

That looks like an interesting avenue to explore.

comment:53 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

port -vdsk test clamav-legacy +tests also fails for ClamAV versions .104.0–.104.2 and it does so as well on macOS High Sierra, Version 10.13.6. ClamAV .103.3 has no tests.

comment:54 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

And now for something completely different: Since I have Time Machine backups back to Snow Leopard from my old MacBook Pro, is it possible to find out from which OS version a backup is and use Migration Assistant or such to install a few old versions of Mac OS X or macOS on a slightly bigger disk?

Will Apple® ever introduce MacBoo? (For Russian and/or Chinese markets?)

comment:55 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

And also MacBoo ScAiry Pro!

comment:56 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

# remove recording of RPATH for the tests, otherwise they will fail
 	    reinplace "s/CMAKE_MACOSX_RPATH 1/CMAKE_MACOSX_RPATH 0/"	${worksrcpath}/CMakeLists.txt

correctly introduces

  158	#
  159	# Set RPATH for custom install prefixes
  160	#
  161	if(APPLE)
  162	    set(CMAKE_MACOSX_RPATH 1)
  163	endif()

in clamav-0.104.2/CMakeLists.txt – but the tests still fail.

comment:57 Changed 2 years ago by kencu (Ken)

maybe don’t worry about that for now? the existing port gets by, don’t rethink it so much. Just get your legacy port in and someday figure out the fancy testing issues, or don’t.

comment:58 Changed 16 months ago by kencu (Ken)

Resolution: wontfix
Status: newclosed

a new port, clamav-legacy, is needed because the current clamav port requires rust to build.

The new port is being tracked here:

#64613

comment:59 Changed 16 months ago by ballapete (Peter "Pete" Dyballa)

clamav @0.104.4 is meanwhile installed, probably the last version that will build on Tiger or on Leopards. Since this ticket has a follow-up, it could be closed?

Note: See TracTickets for help on using tickets.