1. 27 Apr, 2020 4 commits
    • Harald Sitter's avatar
      smb: refine internal error string · afc32611
      Harald Sitter authored
      in master we can break the string so it's slightly less rubbish. give it
      context for the arguments. throw out the reference to stat since
      this may occur from a number of calls. flatten the nested composition of
      errno + strerr
      afc32611
    • Harald Sitter's avatar
      Merge branch 'release/20.04' · 935e8f6a
      Harald Sitter authored
      935e8f6a
    • Harald Sitter's avatar
      smb: put unmapped errno value into error message · 457ee4d5
      Harald Sitter authored
      otherwise it's annoyingly hard to figure out which error isn't mapped.
      this is done through a nested composition so as to not disturb the
      localized string in 20.04
      457ee4d5
    • Harald Sitter's avatar
      smb: accurately attempt to resolve the correct WSD host · a4aefbbd
      Harald Sitter authored
      this previously was the wrong variable. m_current_url is only set after
      url checking while kurl would be the current url under check. this lead
      to state confusion was implicit stat() calls from dolphin on host foo would
      evaluate the previous host (e.g. bar) for the wsd suffix. this meant we'll
      let a foo with suffix pass through the check, and that just mustn't ever
      happen.
      
      BUG: 420578
      FIXED-IN: 20.04.1
      a4aefbbd
  2. 24 Apr, 2020 1 commit
  3. 17 Apr, 2020 1 commit
    • Harald Sitter's avatar
      smb: put a bandaid on a dangling warning I left behind · 12e03aa5
      Harald Sitter authored
      many slaves seem to do this (process bytes, then say the processed size
      is the stat'd size when in fact it may not be). I'll believe it's not a
      huge concern because of that, but even so there should be some indication
      if that expectation fails. a warning should suffice
      12e03aa5
  4. 15 Apr, 2020 1 commit
  5. 14 Apr, 2020 4 commits
  6. 13 Apr, 2020 1 commit
    • Alexander Saoutkin's avatar
      [KIO-MTP] Fix null pointer dereference · 94e7b643
      Alexander Saoutkin authored
      Summary:
      A null pointer can be returned from getDevice() if a device is disconnected.
      Passing NULL into LIBMTP_Get_Storage() results in a NULL pointer dereference.
      
      BUG: 405838
      
      Test Plan:
      Compiles. I couldn't reproduce this as described in the bug report, but from
      reading the attached stacktrace in the bug report it's obvious what went wrong
      here.
      
      Reviewers: akrutzler, dfaure, elvisangelaccio
      
      Reviewed By: elvisangelaccio
      
      Subscribers: anthonyfieroni, kde-frameworks-devel, fvogt, kfm-devel, ngraham
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D28535
      94e7b643
  7. 11 Apr, 2020 1 commit
    • Alexander Kandaurov's avatar
      activities: Close the database connection to prevent file descriptor leak · 8c3c27da
      Alexander Kandaurov authored
      Summary: The connection to the database doesn't get closed, which leads to a leakage of file descriptors to kactivities database files, eventually reaching the open file limit. Also, sometimes warnings about duplicate connections may appear in the console. This patch fixes this by closing and removing the connection.
      
      Test Plan:
        # Right-click a file in Dolphin and hover the Activities menu. Do it several times.
        # Check the output of
      ```
      ls -l /proc/`pidof dolphin`/fd
      ```
      for open descriptors to ~/.local/share/kactivitymanagerd/resources/database{,-wal}.
      
      Reviewers: ivan, meven
      
      Reviewed By: meven
      
      Subscribers: meven, kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D28739
      8c3c27da
  8. 09 Apr, 2020 2 commits
  9. 07 Apr, 2020 2 commits
    • Alexander Saoutkin's avatar
      Fix lifetime of slot in KIO-MTP · f4e0183a
      Alexander Saoutkin authored
      Summary:
      This slot was incorrectly made to last the lifetime of the slave. In fact, this
      slot should only be live for the lifetime of the event loop (one I/O operation).
      
      This can cause issues with the data being emitted for data from other IO
      operations. By making it live in the lifetime of the local event loop this
      scenario cannot occur as LIBMTP only allows one operation at a time.
      
      Test Plan:
      Via the use of KIOFuse (as this is where the bug was noticed).
      Before: Opening a file for the first time worked. Subsequent opens would fail
      due to garbage output After: Opening any number of files at any time works.
      
      Reviewers: akrutzler, dfaure, elvisangelaccio
      
      Subscribers: kde-frameworks-devel, kfm-devel, fvogt
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D28520
      f4e0183a
    • Harald Sitter's avatar
      smb: make all qmin and qmax explicitly typed off_t · f4da469b
      Harald Sitter authored
      also explicitly set the min/max constexprs to off_t explicitly.
      this should now make all related calls act exclusively on concretely typed
      off_ts and as a result build on all platforms with all compilers 🤞
      
      BUG: 419702
      f4da469b
  10. 06 Apr, 2020 6 commits
    • Harald Sitter's avatar
      smb: remove cast again, specify type instead · 143287d5
      Harald Sitter authored
      easier on the eyes. thanks to Pino for the suggestion!
      143287d5
    • Harald Sitter's avatar
      smb: make sure we use balanced arguments on qmax · 95a5ed31
      Harald Sitter authored
      previously there was opportunity for failure here when the deduced literal
      type was different from the actual off_t type and qmax is very picky
      about explicit input types. so, instead cast to off_t, as any int will
      accommodate 0 anyway so the cast has no downsides.
      
      BUG: 419702
      95a5ed31
    • Harald Sitter's avatar
      Merge branch 'release/20.04' · 47d1b272
      Harald Sitter authored
      47d1b272
    • Harald Sitter's avatar
      smb: add hack to support spaces in workgroup names · f40191a1
      Harald Sitter authored
      Summary:
      workgroup names are as best I can tell always still netbios names which
      means they can contain a bunch of characters ordinarily not found in valid
      host names. e.g. spaces
      this causes trouble with the IANA SMB URI draft, as used by libsmbc,
      since the workgroup would be the host field of the RI when browsing
      a workgroup (i.e. filtering hosts that are member of a given workgroup)
      because QUrl does not allow invalid hostnames in the host field.
      
      to bypass this problem we now put the workgroup name into the query of the
      url as `kio-workgroup`, should it cause trouble in the host field. SMBUrl
      takes this query into account when constructing the url for smbc.
      since the latter has uniquely exciting potential for breakage this entire
      dance is only done when absolutely necessary and otherwise we continue with
      all the same code and behavior as without this commit.
      
      on a side note: the awkward name flexibility seems to not extend to
      computer names anymore (supposedly because of LLMNR) so this entire
      use case is already very niche as we (and libsmbclient) currently only
      support workgroup browsing for NT1 networks, and NT1 is by default not
      supported on windows10 or samba.
      
      FIXED-IN: 20.04
      BUG: 204423
      
      Test Plan: builds, test passes, can browse workgroup with space in name
      
      Reviewers: ngraham
      
      Subscribers: kde-frameworks-devel, kfm-devel, thiago
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27804
      f40191a1
    • Harald Sitter's avatar
      smb: use prettyname.kio-discovery-wsd for hostname of wsdiscoveries · daec307b
      Harald Sitter authored
      Summary:
      previously we simply used the ip address. this is fairly awkward though.
      instead try to deduce a resolvable host name from the pretty name.
      
      at discovery time we now mark wsdiscovieres for special handling
      
      at listDir time we then attempt to resolve the name.local and if that
      fails strip the .local to get the presumed LLMNR/netbios name. this means
      the (first) listDir may be slower while we try to find a working hostname
      but discovery is still as fast as possible.
      
      Test Plan: wsdd on linux server resolves as expected, wsd on win10 also resolves as expected
      
      Reviewers: ngraham, meven
      
      Reviewed By: ngraham, meven
      
      Subscribers: kossebau, kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D28513
      daec307b
    • Harald Sitter's avatar
      import license copies via reuse · a2a8facc
      Harald Sitter authored
      for new code in smb source tree
      a2a8facc
  11. 05 Apr, 2020 1 commit
  12. 04 Apr, 2020 3 commits
    • David Edmundson's avatar
      Add 3mf thumbnail support · a5ded8f0
      David Edmundson authored
      Summary:
      3D Modelling Format is based on "Open Packaging Conventions" which is
      already supported by the opendocumentthumbnail spec, we just need to add
      the relevant mime type so our thumbnailer gets used.
      
      CCBUG: 407431
      
      Test Plan:
      Registed mime type from glob.
      (I should submit this to fd-shared-mime spec)
      Opened dolphin with a 3mf file with a thumbnail.
      It "just worked"
      
      Reviewers: broulik
      
      Reviewed By: broulik
      
      Subscribers: kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D28570
      a5ded8f0
    • Script Kiddy's avatar
      SVN_SILENT made messages (.desktop file) - always resolve ours · 6cb7e46a
      Script Kiddy authored
      In case of conflict in i18n, keep the version of the branch "ours"
      To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
      6cb7e46a
    • Script Kiddy's avatar
      SVN_SILENT made messages (.desktop file) - always resolve ours · 2ac89be3
      Script Kiddy authored
      In case of conflict in i18n, keep the version of the branch "ours"
      To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
      2ac89be3
  13. 03 Apr, 2020 4 commits
    • Harald Sitter's avatar
      smb: fast copy · 46b5fb42
      Harald Sitter authored
      Summary:
      see https://bugs.kde.org/show_bug.cgi?id=291835#c57 for background
      
      - reading now happens inside a future. should be safe since we don't have
        any other threads doing anything while we wait.
      - the future feeds into a buffer from which the main thread will
        take file segments and write them to disk
      - buffer has 4 segments and synchronizes the threads via wait conditions
      - the size of a segment is determined somewhat dynamically between 64kb
        and 4mb. the larger a file is the more it benefits from larger
        read requests
      
      under perfect conditions this yields approximately mount-level copy
      performance, unfortunately those are hard to hit so on average it's usually
      less (somewhere in the range of 10 to 20% depending on the actual file
      size and server type).
      
      for many tiny files performance is about where it was before. the larger
      the files get the greater the gains from this diff though.
      
      specifically here's some samples I've taken:
      
      - for downloads from windows10
        - 1G & 4G file
          - compared to 20.04 is ~77% faster
          - within 10% of windows
        - 8G file
          - compared to 20.04 is ~79% faster
          - within 5% of windows
      - uploads to windows10
        - all sizes
          - compared to 20.04 is ~50% faster
          - now comparable performance to windows
      - for remote-to-remote file copies from windows10 to smbd 4.11.6
        - 1000 x 5K files
          - no change, dreadfully slow, likely problem in KIO internals
        - 1G file
          - compared to 20.04 is ~45% faster
          - within 8% of windows
        - 4G file
          - compared to 20.04 is ~95% faster
          - and somehow 18% faster than windows (could be a fluke)
      
      I've done transfers for 128M, 256M, 512M, 1G, 4G and partially 8G.
      Differences not mentioned are either unchanged, negligible or in line with
      documented trends.
      
      BUG: 291835
      FIXED-IN: 20.08
      
      Test Plan:
      - fallocate -l 1G file
      - copy around
      - copy kio-extras around
      
      Reviewers: ngraham, cfeck, #frameworks, #dolphin
      
      Subscribers: mmustac, meven, hallas, anthonyfieroni, asturmlechner, kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27504
      46b5fb42
    • Friedrich W. H. Kossebau's avatar
      Use more UDSEntry::reserve() calls to avoid reallocs on multiple inserts · 7e679b13
      Friedrich W. H. Kossebau authored
      Reviewers: #frameworks, sitter, meven
      
      Reviewed By: meven
      
      Subscribers: kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D28538
      7e679b13
    • Script Kiddy's avatar
      SVN_SILENT made messages (.desktop file) - always resolve ours · 1f1f355b
      Script Kiddy authored
      In case of conflict in i18n, keep the version of the branch "ours"
      To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
      1f1f355b
    • Script Kiddy's avatar
      SVN_SILENT made messages (.desktop file) - always resolve ours · a22f9fad
      Script Kiddy authored
      In case of conflict in i18n, keep the version of the branch "ours"
      To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
      a22f9fad
  14. 29 Mar, 2020 2 commits
  15. 28 Mar, 2020 1 commit
  16. 27 Mar, 2020 1 commit
  17. 25 Mar, 2020 4 commits
    • Harald Sitter's avatar
      Merge branch 'release/20.04' · 75b8f3a1
      Harald Sitter authored
      75b8f3a1
    • Harald Sitter's avatar
      sftp: fix partial transfer resuming when copying to local · 8a04e100
      Harald Sitter authored
      Summary:
      the previous condition checked if the final target path size was >0,
      which it would only be when the file already exists (i.e. overwrite) in
      all other scenarios it would always be false and as such resuming wouldn't
      work. what we actually want to check is whether the part file is >0 (i.e.
      there's actual pending bytes to resume from).
      
      this makes resuming work when copying remote->local
      
      CCBUG: 417645
      
      Test Plan:
      - create file of suitably large size (1g)
      - `split -b somesize` the file into two segments
      - copy first segment to /tmp/file.part
      - connect to /tmp over sftp and copy the file there
      - progress starts at 50% and resulting file is same as input file
      
      Reviewers: ngraham, feverfew, bruns
      
      Subscribers: bruns, kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27872
      8a04e100
    • Harald Sitter's avatar
      sftp: do not show creation time when we do not know it · b13449a1
      Harald Sitter authored
      Summary:
      creation time (aka birth time) is file system dependent, if the fs doesn't
      support it we seem to get createtime==0. skip over it when that is the
      case.
      
      BUG: 375305
      FIXED-IN: 20.04
      
      Test Plan: browsing a directory on btrfs over sftp doesn't show creation time as 1970
      
      Reviewers: ngraham, bruns, meven
      
      Reviewed By: ngraham, bruns, meven
      
      Subscribers: meven, bruns, kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27873
      b13449a1
    • Harald Sitter's avatar
      smb: add some more topical debug output on opendir failure · 6ab34e5c
      Harald Sitter authored
      the output seen in https://bugs.kde.org/show_bug.cgi?id=419038 isn't
      nearly useful enough.
      
      - log the actual errnum (i.e. errno) after opendir
      - if the dirfd is negative log the approximate steps to recover
      
      specifically we end up with errnum==0 in reportError which makes no sense
      whatsoever and from the output it's not currently obvious which call
      chain lead to that scenario. possibly should be changed to assert even,
      not doing that for now though because I want this in 20.04
      6ab34e5c
  18. 24 Mar, 2020 1 commit