Skip to content

Commit

Permalink
Bug/errormessage file check (#411)
Browse files Browse the repository at this point in the history
* minor bugfixes Github

* minor bugfixes Github

* build fix for 19.04

* removed 19.04 as the build pipeline dows not support it
  • Loading branch information
NaraVen authored May 27, 2020
1 parent ff8799a commit 64a9a3e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
38 changes: 23 additions & 15 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- script: |
sudo apt-get install pkg-config libfuse-dev cmake libcurl4-gnutls-dev libgnutls28-dev uuid-dev libgcrypt20-dev libboost-all-dev gcc g++ -y
. ./build.sh
mkdir $(Build.ArtifactStagingDirectory)/1604
cp ./blobfuse $(Build.ArtifactStagingDirectory)/1604
cp ../systemd/10-blobfuse.conf $(Build.ArtifactStagingDirectory)/1604
cp ../systemd/blobfuse-logrotate $(Build.ArtifactStagingDirectory)/1604
mkdir $(Build.ArtifactStagingDirectory)/$(container_image)
cp ./blobfuse $(Build.ArtifactStagingDirectory)/$(container_image)
cp ../systemd/10-blobfuse.conf $(Build.ArtifactStagingDirectory)/$(container_image)
cp ../systemd/blobfuse-logrotate $(Build.ArtifactStagingDirectory)/$(container_image)
cp ./blobfusetests $(Build.BinariesDirectory)
make package
cp ./blobfuse-*.*.*-Linux.deb $(Build.ArtifactStagingDirectory)/1604
cp ./blobfuse-*.*.*-Linux.deb $(Build.ArtifactStagingDirectory)/$(container_image)
env:
INCLUDE_TESTS: 1
displayName: Generate blobfuse build for Ubuntu 16.04
Expand All @@ -39,25 +39,33 @@ jobs:
workingDirectory: $(Build.BinariesDirectory)
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts for blobfuse Ubuntu 16.04'
displayName: 'Publish Artifacts for blobfuse $(container_image)'
condition: succeededOrFailed()

# Add ubuntu-20.04 and more releases here.
- job: Linux_Build_18_19

- job: Linux_Build_1804
strategy:
maxParallel: 8
matrix:
UBUNTU1804:
container_image: 'ubuntu-18.04'
build_type: Release

pool:
vmImage: 'ubuntu-18.04'
vmImage: $(container_image)
steps:
- script: |
sudo apt-get install pkg-config libfuse-dev cmake libcurl4-gnutls-dev libgnutls28-dev uuid-dev libgcrypt20-dev libboost-all-dev gcc g++ -y
. ./build.sh
mkdir $(Build.ArtifactStagingDirectory)/1804
cp ./blobfuse $(Build.ArtifactStagingDirectory)/1804
cp ../systemd/10-blobfuse.conf $(Build.ArtifactStagingDirectory)/1804
cp ../systemd/blobfuse-logrotate $(Build.ArtifactStagingDirectory)/1804
mkdir $(Build.ArtifactStagingDirectory)/$(container_image)
cp ./blobfuse $(Build.ArtifactStagingDirectory)/$(container_image)
cp ../systemd/10-blobfuse.conf $(Build.ArtifactStagingDirectory)/$(container_image)
cp ../systemd/blobfuse-logrotate $(Build.ArtifactStagingDirectory)/$(container_image)
make package
cp ./blobfuse-*.*.*-Linux.deb $(Build.ArtifactStagingDirectory)/1804
displayName: Generate blobfuse build for Ubuntu 18.04
cp ./blobfuse-*.*.*-Linux.deb $(Build.ArtifactStagingDirectory)/$(container_image)
displayName: Generate blobfuse build for $(container_image)
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts for blobfuse Ubuntu 18.04'
displayName: 'Publish Artifacts for blobfuse $(container_image)'
condition: succeededOrFailed()

10 changes: 5 additions & 5 deletions blobfuse/blobfuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class gc_cache gc_cache;
// Currently, the cpp lite lib puts the HTTP status code in errno.
// This mapping tries to convert the HTTP status code to a standard Linux errno.
// TODO: Ensure that we map any potential HTTP status codes we might receive.
std::map<int, int> error_mapping = {{404, ENOENT}, {403, EACCES}, {1600, ENOENT}};
std::map<int, int> error_mapping = {{404, ENOENT}, {403, EACCES}, {1600, ENOENT}, {400, EFAULT}};

const std::string former_directory_signifier = ".directory";

Expand Down Expand Up @@ -164,9 +164,9 @@ int read_config_env()
}
else
{
syslog(LOG_CRIT, "Unable to start blobfuse. No config file was specified and the AZURE_STORAGE_ACCCOUNT"
syslog(LOG_CRIT, "Unable to start blobfuse. No config file was specified and the AZURE_STORAGE_ACCOUNT"
"environment variable was empty");
fprintf(stderr, "Unable to start blobfuse. No config file was specified and the AZURE_STORAGE_ACCCOUNT"
fprintf(stderr, "Unable to start blobfuse. No config file was specified and the AZURE_STORAGE_ACCOUNT"
"environment variable was empty\n");
return -1;
}
Expand Down Expand Up @@ -329,13 +329,13 @@ int read_config(const std::string configFile)
if(str_options.accountName.empty())
{
syslog (LOG_CRIT, "Unable to start blobfuse. Account name is missing in the config file.");
fprintf(stderr, "Account name is missing in the config file.\n");
fprintf(stderr, "Unable to start blobfuse. Account name is missing in the config file.\n");
return -1;
}
else if(str_options.containerName.empty())
{
syslog (LOG_CRIT, "Unable to start blobfuse. Container name is missing in the config file.");
fprintf(stderr, "Container name is missing in the config file.\n");
fprintf(stderr, "Unable to start blobfuse. Container name is missing in the config file.\n");
return -1;
}
else
Expand Down
5 changes: 3 additions & 2 deletions blobfuse/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ int azs_getattr(const char *path, struct stat *stbuf)
if (acc != -1 )
{
AZS_DEBUGLOGV("Accessing mntPath = %s for get_attr succeeded; object is in the local cache.\n", mntPathString.c_str());
//(void) fi;

res = lstat(mntPathString.c_str(), stbuf);
if (res == -1)
{
Expand All @@ -436,7 +436,8 @@ int azs_getattr(const char *path, struct stat *stbuf)
std::string blobNameStr(&(path[1]));
errno = 0;
list_blobs_hierarchical_response response = azure_blob_client_wrapper->list_blobs_hierarchical(str_options.containerName, "/", "", blobNameStr, 2) ;
if (errno == 0 && response.blobs.size() > 0)

if (errno == 0 && response.blobs.size() > 0 && (!response.blobs[0].name.compare(blobNameStr) || !response.blobs[0].name.compare(blobNameStr + '/')) )
{
// the first element should be exact match prefix
if (is_directory_blob(0, response.blobs[0].metadata) || response.blobs[0].is_directory)
Expand Down

0 comments on commit 64a9a3e

Please sign in to comment.