| Re: [hatari-devel] Error when saving files | 
[ Thread Index | 
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
] 
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Error when saving files
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Wed, 7 Dec 2022 22:55:35 +0100
- Authentication-results: strato.com;    dkim=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1670450184;    s=strato-dkim-0002; d=seimet.de;    h=In-Reply-To:References:Message-ID:Subject:To:From:Date:Cc:Date:From:    Subject:Sender;    bh=/sQSjBKGDm0Bo2CmkyCXY5ZW5syP7Ff3YRkQskcDtoQ=;    b=A5V1tRcdM116vTrPvUFKjn+SCMIJ1FvqMW//F8HuyMjgjO8b34JwKfcLOCX/+ugFfP    H7747dVS5VeHkYUJ3tVGVhOVxZcnbrC7ktKZoUmAx+TmrU/xNu3BBkiSl+gHn+wiYBtE    dqyWd/DWtmIxkesdThp7VRMu+p4lGTSaN7uVai5bIz1N3wehQW9EaFkv5MIOxYwayAtN    7Swv3JkGW8hQvKIxFtSG+mLcW3kICZV5ZGvUKYZuidDNk/h59gB+1ijJj65xwInjUT5D    SYVhGaXatRvhAMNkTQHfpWFtHaIiVLCm5tLJ09AzZhSuDY1gL+HIRBLENDC+qH5XaQfw    2/fw==
Hi,
The patch fixes the issue. Do you still need the full trace based on the
non-patched sources?
Best regards
Uwe
> Hi,
> 
> On 7.12.2022 15.55, Uwe Seimet wrote:
> >> Are you sure this is (still) Hatari issue?
> > 
> > Yes, I am sure because nothing else except Hatari would touch this file,
> > and . At
> > the beginning of the log these are the file permissions:
> > 
> > -rw-rw-rw- 1 us users 4364 Dez  7 14:50 EDISON.RSM
> > 
> > At the end of the log they are:
> > 
> > -r--r--r-- 1 us users 4364 Dez  7 14:51 EDISON.RSM
> 
> Ok, in that case I need more info, at least full "--trace gemdos" trace.
> 
> 
> > The commit causing this issue is 8fe983f2. Before this commit everything is
> > fine, as it always was.
> 
> Does reverting just the GemDOS_ConvertAttribute() part (attached) of the 
> commit, fix the issue?
> 
> 
> 	- Eero
> --- a/src/gemdos.c
> +++ b/src/gemdos.c
> @@ -273,7 +273,7 @@ static bool GemDOS_SetFileInformation(int Handle, DATETIME *DateTime)
>  /**
>   * Convert from FindFirstFile/FindNextFile attribute to GemDOS format
>   */
> -static uint8_t GemDOS_ConvertAttribute(mode_t mode)
> +static uint8_t GemDOS_ConvertAttribute(mode_t mode, const char *path)
>  {
>  	uint8_t Attrib = 0;
>  
> @@ -282,7 +282,7 @@ static uint8_t GemDOS_ConvertAttribute(mode_t mode)
>  		Attrib |= GEMDOS_FILE_ATTRIB_SUBDIRECTORY;
>  
>  	/* Read-only attribute */
> -	if (!(mode & S_IWUSR))
> +	if (!(mode & S_IWUSR) || !access(path, W_OK))
>  		Attrib |= GEMDOS_FILE_ATTRIB_READONLY;
>  
>  	/* TODO, Other attributes:
> @@ -326,7 +326,7 @@ static dta_ret_t PopulateDTA(char *path, struct dirent *file, DTA *pDTA, uint32_
>  		return DTA_ERR;   /* no DTA pointer set */
>  
>  	/* Check file attributes (check is done according to the Profibuch) */
> -	nFileAttr = GemDOS_ConvertAttribute(filestat.st_mode);
> +	nFileAttr = GemDOS_ConvertAttribute(filestat.st_mode, tempstr);
>  	nAttrMask = nAttrSFirst|GEMDOS_FILE_ATTRIB_WRITECLOSE|GEMDOS_FILE_ATTRIB_READONLY;
>  	if (nFileAttr != 0 && !(nAttrMask & nFileAttr))
>  		return DTA_SKIP;
> @@ -2616,7 +2615,7 @@ static bool GemDOS_Fattrib(uint32_t Params)
>  	if (nRwFlag == 0)
>  	{
>  		/* Read attributes */
> -		Regs[REG_D0] = GemDOS_ConvertAttribute(FileStat.st_mode);
> +		Regs[REG_D0] = GemDOS_ConvertAttribute(FileStat.st_mode, sActualFileName);
>  		return true;
>  	}
>