Skip to content

fix(cfapi): CfConvertToPlaceholder dir 0x8007017c — déjà placeholder, traiter comme no-op #156

Description

@CCoupel

Symptôme (logs observés)

cfapi: CfConvertToPlaceholder C:\GhostDrive\MFS\ghostdrive_ec_test isDir=true: HRESULT 0x8007017c
cfapi: CfConvertToPlaceholder C:\GhostDrive\MFS\C411_Uploader isDir=true: HRESULT 0x8007017c
cfapi: CfConvertToPlaceholder C:\GhostDrive\MFS\test isDir=true: HRESULT 0x8007017c

Log répété à chaque FETCH_PLACEHOLDERS — fausse alerte suggérant une corruption CF.

Code path

createPlaceholdersWithFlags dans provider.go — branche hrAlreadyExists :
quand CfCreatePlaceholders retourne hrAlreadyExists pour un dossier existant localement,
le code appelle ghd_convert_dir_to_placeholder (= CfConvertToPlaceholder avec CF_CONVERT_FLAG_ENABLE_ON_DEMAND_POPULATION).

Root cause

CF_CONVERT_FLAG_ENABLE_ON_DEMAND_POPULATION N'EST PAS IDEMPOTENT pour les dossiers.
Contrairement à CF_CONVERT_FLAG_MARK_IN_SYNC (pour les fichiers, idempotent), ENABLE_ON_DEMAND_POPULATION retourne 0x8007017c (ERROR_CLOUD_FILE_INVALID_REQUEST) si le dossier est déjà un placeholder CF.

Séquence :

  1. 1er FETCH_PLACEHOLDERS : ghd_convert_dir_to_placeholder réussit (dossier NTFS ordinaire → placeholder CF)
  2. 2ème+ FETCH_PLACEHOLDERS : ghd_convert_dir_to_placeholder0x8007017c (dossier déjà placeholder) → log d'erreur trompeur

Lien avec 0x80070781

Ces erreurs 0x8007017c sont bénignes — pas de write partiel, pas de corruption CF. Le dossier IS déjà un placeholder CF fonctionnel. La garde placeholderOK de #152 ne s'applique pas ici (code path séparé — createPlaceholdersWithFlagsdispatcher.go).

Fix

internal/cfapi/provider.go — ajouter hrAlreadyPlaceholder = 0x8007017c et le traiter comme no-op silencieux pour les dossiers :

if item.IsDirectory && xhrCode == hrAlreadyPlaceholder {
    // déjà un CF placeholder — ENABLE_ON_DEMAND_POPULATION non idempotent — no-op attendu
} else {
    log.Printf("cfapi: CfConvertToPlaceholder %s ...")
}

Tests

TestRegression156_DirConvert_AlreadyPlaceholder — 6 cas (dir/file × 3 HRESULT)
TestRegression156_HRAlreadyPlaceholder_ConstantValue — vérifie le calcul HRESULT_FROM_WIN32

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendCode Go / moteur de synchronisationbugSomething isn't workingwindows-apiCloud Filter API, WinFsp, placeholders

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions