Received files are not retained when the temp file path is 20 characters or longer

Aperta Adatta ai principianti
#540 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Leggi fsw/src/cf_cfdp_r.c in corrispondenza dei buffer TempName alle righe 390 e 695, quindi esegui la riproduzione con i numeri di sequenza 9999 e 10000. Conferma che i file ricevuti vengono conservati nelle destinazioni richieste per entrambe le lunghezze dei percorsi; il rapporto afferma che un buffer più grande ha conservato anche la sequenza 123456789.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug

CF loses a received file when its temp file path is 20 characters or longer.

CF_CFDP_R_Init() gets the temp path in a 20-byte buffer (fsw/src/cf_cfdp_r.c:390), so CF creates the file under a truncated name. CF_CFDP_R_HandleFileRetention() gets the same path in a 64-byte buffer (:695) and tries to move the file from the full path. No file has that name, so the move fails.

With the default tmp_dir (/cf/tmp), this starts at sequence number 10000 for source entity 23. The file does not get to its destination, and its data stays in the temp directory. A class 1 sender gets no error.

To Reproduce

Send two class 1 uploads from entity 23 on channel 0, with sequence numbers 9999 and 10000 and destinations /cf/upl_9999.txt and /cf/upl_10000.txt. CF retains 9999. For 10000 it logs:

CF R1(23:10000): starting transaction using temp file '/cf/tmp/23_10000.tm'
CF R1(23:10000): cannot move file to /cf/upl_10000.txt, error=-1

Expected behavior

CF retains 10000.

Code snips

-    char  TempName[CFE_MISSION_MAX_FILE_LEN];
+    char  TempName[CFE_MISSION_MAX_PATH_LEN];

With this change, CF retained 9999, 10000 and 123456789.

System observed on:

  • Raspberry Pi 4, aarch64, cFS v7.0.1 (CF 7.0.1.0).

Reporter Info

Personal

Lingua principale
C
Stelle
122
Fork
82
Merge medio
2g 4h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nasa/CF

Tutte le issue di nasa/CF

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.