possible typo in 11.12 source?

Discuss new features and functions
Posts: 306
Joined: 7 Jan 2018

bgstack15

In source file FreeFileSync_11.12_Source.zip (sha1sum cfdd7e6f894394be6171fa4391456776c6468a36), file FreeFileSync/Source/afs/sftp.cpp is different from version 11.11.
I get a compilation error:
g++-10 -std=c++2a -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wnon-virtual-dtor -Wno-unused-function -Wshadow -Wno-maybe-uninitialized -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags openssl` `pkg-config --cflags libcurl` `pkg-config --cflags libssh2` `pkg-config --cflags gtk+-3.0` -isystem/usr/include/gtk-3.0 `pkg-config --cflags libselinux` -DHAVE_SELINUX -c afs/sftp.cpp -o /tmp/FreeFileSync_Make/ffs/src/afs/sftp.cpp.o
afs/sftp.cpp: In function '{anonymous}::SftpItemDetails {anonymous}::getSymlinkTargetDetails(const fff::SftpLogin&, const fff::AfsPath&)':
afs/sftp.cpp:1091:28: error: expected primary-expression before '(' token
 1091 |             throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtPath(getSftpDisplayPath(login., linkPath))), L"File size not supported.");
      |                            ^
compilation terminated due to -Wfatal-errors.
make: *** [Makefile:131: /tmp/FreeFileSync_Make/ffs/src/afs/sftp.cpp.o] Error 1
make: Leaving directory '/usr/src/freefilesync/11.12-1/FreeFileSync/Source'
Git diff shows
@@ -1092,19 +1076,19 @@ SftpItemDetails getSymlinkTargetDetails(const SftpLogin& login, const AfsPath& l
         runSftpCommand(login, "libssh2_sftp_stat", //throw SysError
         [&](const SshSession::Details& sd) { return ::libssh2_sftp_stat(sd.sftpChannel, getLibssh2Path(linkPath), &attribsTrg); }); //noexcept!
     }
-    catch (const SysError& e) { throw FileError(replaceCpy(_("Cannot resolve symbolic link %x."), L"%x", fmtPath(getSftpDisplayPath(login.server, linkPath))), e.toString()); }
+    catch (const SysError& e) { throw FileError(replaceCpy(_("Cannot resolve symbolic link %x."), L"%x", fmtPath(getSftpDisplayPath(login, linkPath))), e.toString()); }

     if ((attribsTrg.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) == 0)
-        throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtPath(getSftpDisplayPath(login.server, linkPath))), L"File attributes not available.");
+        throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtPath(getSftpDisplayPath(login, linkPath))), L"File attributes not available.");

     if (LIBSSH2_SFTP_S_ISDIR(attribsTrg.permissions))
         return {AFS::ItemType::folder, 0, static_cast<time_t>(attribsTrg.mtime)};
     else
     {
         if ((attribsTrg.flags & LIBSSH2_SFTP_ATTR_ACMODTIME) == 0) //server probably does not support these attributes => should fail at folder level!
-            throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtPath(getSftpDisplayPath(login.server, linkPath))), L"Modification time not supported.");
+            throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtPath(getSftpDisplayPath(login, linkPath))), L"Modification time not supported.");
         if ((attribsTrg.flags & LIBSSH2_SFTP_ATTR_SIZE) == 0)
-            throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtPath(getSftpDisplayPath(login.server, linkPath))), L"File size not supported.");
+            throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtPath(getSftpDisplayPath(login., linkPath))), L"File size not supported.");

         return {AFS::ItemType::file, attribsTrg.filesize, static_cast<time_t>(attribsTrg.mtime)};
     }
The offending line appears to be the one with string literal "login., linkPath", line 1091. It appears that instead of using login.server like before, the value should now just be login but the period was left in place.
User avatar
Site Admin
Posts: 7048
Joined: 9 Dec 2007

Zenju

Thank you! Fixed.